multica-ai/multica · error

%s id is required

Error message

%s id is required

What it means

Returned by resolveIDByPrefix when the input trims to an empty string. It is the generic per-kind equivalent of the empty-id check, prefixed with the resource kind (e.g. "autopilot id is required"), so the user knows which argument is missing.

Source

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

	if len(prefix) < minShortIDPrefixLen {
		return "", fmt.Errorf("expected a full UUID or at least %d hex characters, got %q", minShortIDPrefixLen, input)
	}
	for _, r := range prefix {
		if !((r >= '0' && r <= '9') || (r >= 'a' && r <= 'f')) {
			return "", fmt.Errorf("expected a UUID prefix containing only hex characters, got %q", input)
		}
	}
	return prefix, nil
}

func compactUUID(id string) string {
	return strings.ToLower(strings.ReplaceAll(strings.TrimSpace(id), "-", ""))
}

func resolveIDByPrefix(ctx context.Context, client *cli.APIClient, kind, input string, fetch func(context.Context, *cli.APIClient) ([]idCandidate, error)) (resolvedID, error) {
	trimmed := strings.TrimSpace(input)
	if trimmed == "" {
		return resolvedID{}, fmt.Errorf("%s id is required", kind)
	}
	if uuidRegexp.MatchString(trimmed) {
		return resolvedID{ID: trimmed, Display: trimmed}, nil
	}

	prefix, err := normalizeUUIDPrefix(trimmed)
	if err != nil {
		return resolvedID{}, fmt.Errorf("resolve %s: %w", kind, err)
	}

	candidates, err := fetch(ctx, client)
	if err != nil {
		return resolvedID{}, fmt.Errorf("resolve %s: %w", kind, err)
	}

	matches := make([]idCandidate, 0, 1)
	for _, c := range candidates {
		if c.ID == "" {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Provide a non-empty id for the indicated resource kind
  2. Guard the call site: only invoke the command when the variable is non-empty
  3. Use shell parameter expansion with a default or error: "${VAR:?autopilot id is required}"

Example fix

# before
multica autopilot info ""

# after
multica autopilot info "$AUTOPILOT_ID"  # ensure AUTOPILOT_ID is set and non-empty
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(idArg) == "" {
    return fmt.Errorf("%s id is required", kind)
}
// only invoke the CLI when the id is present

Prevention

When it happens

Trigger: Calling any prefix-resolving command (autopilot, project, label, task run, autopilot trigger) with an empty or whitespace-only id argument. Common when a flag like --id receives an empty expanded variable.

Common situations: Unset environment variables expanded to empty strings in scripts; optional flags forwarded unconditionally from wrappers; CI parameters left blank.

Related errors


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