multica-ai/multica · error

--runtime-id must not be empty

Error message

--runtime-id must not be empty

What it means

Thrown by `multica agent copy` when --runtime-id was explicitly set on the command line but its value is the empty string. The CLI checks Changed("runtime-id") first, so the flag counts as supplied even when empty, and the empty value is then rejected before any POST. Typically a shell variable expanding to nothing.

Source

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

	}

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	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
	}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Supply a real runtime ID: multica runtime list, then --runtime-id <id>
  2. Or omit --runtime-id entirely to copy within the source agent's runtime
  3. In scripts, conditionally include the flag only when the variable is non-empty

Example fix

# before
multica agent copy <id> --runtime-id "$RT"   # RT=""
# after
multica agent copy <id>                      # same-runtime copy
# or
multica agent copy <id> --runtime-id rt_abc123
Defensive patterns

Strategy: validation

Validate before calling

if [ -n "${RUNTIME_ID:-}" ]; then
  multica agent copy "$AGENT_ID" --runtime-id "$RUNTIME_ID"
else
  multica agent copy "$AGENT_ID"
fi

Prevention

When it happens

Trigger: `multica agent copy <id> --runtime-id "$RUNTIME"` with RUNTIME unset/empty; scripts passing --runtime-id= with an empty default; whitespace-only is not saved either since only == "" is checked after GetString.

Common situations: Optional runtime selection in a wrapper script where the variable was never populated; copy-paste of a command template with a placeholder left empty.

Related errors


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