multica-ai/multica · error

source agent has no runtime; pass --runtime-id to choose a t

Error message

source agent has no runtime; pass --runtime-id to choose a target runtime

What it means

Thrown by `multica agent copy` when the source agent's runtime_id is empty in the API response and no --runtime-id override was given. The copy needs a target runtime to build the POST body, and a source without one provides no default. This indicates old or partial data on the source agent rather than a flag typo.

Source

Thrown at server/cmd/multica/cmd_agent_copy.go:123

	var src map[string]any
	if err := client.GetJSON(ctx, "/api/agents/"+args[0], &src); err != nil {
		return fmt.Errorf("get source agent: %w", err)
	}

	srcRuntimeID := strVal(src, "runtime_id")

	// Resolve the target runtime: default to the source's runtime, override
	// with --runtime-id. A different value is a cross-runtime fork.
	targetRuntimeID := srcRuntimeID
	if cmd.Flags().Changed("runtime-id") {
		v, _ := cmd.Flags().GetString("runtime-id")
		if v == "" {
			return fmt.Errorf("--runtime-id must not be empty")
		}
		targetRuntimeID = v
	}
	if targetRuntimeID == "" {
		return fmt.Errorf("source agent has no runtime; pass --runtime-id to choose a target runtime")
	}
	sameRuntime := targetRuntimeID == srcRuntimeID

	// Name: default "<source name> (copy)", override with --name.
	name := strVal(src, "name") + " (copy)"
	if cmd.Flags().Changed("name") {
		v, _ := cmd.Flags().GetString("name")
		if v == "" {
			return fmt.Errorf("--name must not be empty")
		}
		name = v
	}

	body := map[string]any{
		"name":       name,
		"runtime_id": targetRuntimeID,
	}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Pass an explicit target: multica runtime list, then multica agent copy <id> --runtime-id <id>
  2. Investigate why the source lacks a runtime (deleted runtime? legacy record?) and repair or re-create the source agent if it should have one

Example fix

# before
multica agent copy <id>   # source has empty runtime_id
# after
multica agent copy <id> --runtime-id rt_abc123
Defensive patterns

Strategy: validation

Validate before calling

# check the source has a runtime before copying
RT=$(multica agent get "$AGENT_ID" --output json | jq -r '.runtime_id // empty')
if [ -z "$RT" ]; then
  multica agent copy "$AGENT_ID" --runtime-id "$TARGET_RT"
else
  multica agent copy "$AGENT_ID"
fi

Prevention

When it happens

Trigger: `multica agent copy <id>` where GET /api/agents/{id} returns runtime_id as "" or missing, and --runtime-id is not set on the command line.

Common situations: Agents created before runtimes existed or by an older API version; agents whose runtime was deleted; imported/migrated records with null runtime fields.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/f9a35be4cccb7b5d. Report an issue: GitHub.