multica-ai/multica · error

workspace_id is required to resolve autopilot id prefixes

Error message

workspace_id is required to resolve autopilot id prefixes

What it means

Returned by fetchAutopilotCandidates when the CLI client has no WorkspaceID set. Autopilot listing is workspace-scoped (the API requires a workspace_id query parameter), so prefix resolution cannot even query candidates without it. Full UUIDs are unaffected because they short-circuit before the fetch.

Source

Thrown at server/cmd/multica/cmd_id_resolver.go:218

	_, ok := parsePositiveInt(input[dash+1:])
	return ok
}

func parsePositiveInt(input string) (int, bool) {
	n, err := strconv.Atoi(strings.TrimSpace(input))
	if err != nil || n <= 0 {
		return 0, false
	}
	return n, true
}

func resolveAutopilotID(ctx context.Context, client *cli.APIClient, input string) (resolvedID, error) {
	return resolveIDByPrefix(ctx, client, "autopilot", input, fetchAutopilotCandidates)
}

func fetchAutopilotCandidates(ctx context.Context, client *cli.APIClient) ([]idCandidate, error) {
	if client.WorkspaceID == "" {
		return nil, fmt.Errorf("workspace_id is required to resolve autopilot id prefixes")
	}
	const limit = resolverListPageLimit
	candidates := []idCandidate{}
	seen := map[string]struct{}{}
	for offset := 0; ; {
		params := url.Values{}
		params.Set("workspace_id", client.WorkspaceID)
		params.Set("limit", strconv.Itoa(limit))
		if offset > 0 {
			params.Set("offset", strconv.Itoa(offset))
		}
		var resp struct {
			Autopilots []map[string]any `json:"autopilots"`
			Total      int              `json:"total"`
			HasMore    bool             `json:"has_more"`
		}
		if err := client.GetJSON(ctx, "/api/autopilots?"+params.Encode(), &resp); err != nil {
			return nil, err

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Configure or select a workspace for the CLI session (config file, flag, or environment, per the CLI's workspace selection mechanism)
  2. Or pass the full autopilot UUID, which skips candidate fetching entirely
  3. Verify with a workspace-listing command that the target workspace exists and is accessible

Example fix

# before
multica autopilot info "ab12"
# error: workspace_id is required to resolve autopilot id prefixes

# after
multica --workspace <workspace-id-or-name> autopilot info "ab12"
# or: multica autopilot info <full-uuid-from-list>
Defensive patterns

Strategy: validation

Validate before calling

if client.WorkspaceID == "" {
    return errors.New("select a workspace before resolving autopilot prefixes")
}
// or use the full UUID, which needs no workspace for resolution

Prevention

When it happens

Trigger: Running an autopilot command with a short UUID prefix while the API client was constructed without a workspace id — e.g. no workspace selected/configured in the CLI profile, or a command context that does not inject WorkspaceID.

Common situations: Fresh CLI installs with no default workspace configured; running inside automation where the workspace flag was omitted; profile misconfiguration after workspace deletion.

Related errors


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