{"record":{"id":"63e6281473f228e1","repo":"multica-ai/multica","slug":"s-id-is-required","errorCode":null,"errorMessage":"%s id is required","messagePattern":"(.+?) id is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_id_resolver.go","lineNumber":79,"sourceCode":"\tif len(prefix) < minShortIDPrefixLen {\n\t\treturn \"\", fmt.Errorf(\"expected a full UUID or at least %d hex characters, got %q\", minShortIDPrefixLen, input)\n\t}\n\tfor _, r := range prefix {\n\t\tif !((r >= '0' && r <= '9') || (r >= 'a' && r <= 'f')) {\n\t\t\treturn \"\", fmt.Errorf(\"expected a UUID prefix containing only hex characters, got %q\", input)\n\t\t}\n\t}\n\treturn prefix, nil\n}\n\nfunc compactUUID(id string) string {\n\treturn strings.ToLower(strings.ReplaceAll(strings.TrimSpace(id), \"-\", \"\"))\n}\n\nfunc resolveIDByPrefix(ctx context.Context, client *cli.APIClient, kind, input string, fetch func(context.Context, *cli.APIClient) ([]idCandidate, error)) (resolvedID, error) {\n\ttrimmed := strings.TrimSpace(input)\n\tif trimmed == \"\" {\n\t\treturn resolvedID{}, fmt.Errorf(\"%s id is required\", kind)\n\t}\n\tif uuidRegexp.MatchString(trimmed) {\n\t\treturn resolvedID{ID: trimmed, Display: trimmed}, nil\n\t}\n\n\tprefix, err := normalizeUUIDPrefix(trimmed)\n\tif err != nil {\n\t\treturn resolvedID{}, fmt.Errorf(\"resolve %s: %w\", kind, err)\n\t}\n\n\tcandidates, err := fetch(ctx, client)\n\tif err != nil {\n\t\treturn resolvedID{}, fmt.Errorf(\"resolve %s: %w\", kind, err)\n\t}\n\n\tmatches := make([]idCandidate, 0, 1)\n\tfor _, c := range candidates {\n\t\tif c.ID == \"\" {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_id_resolver.go#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"Unset environment variables expanded to empty strings in scripts; optional flags forwarded unconditionally from wrappers; CI parameters left blank.","solutions":["Provide a non-empty id for the indicated resource kind","Guard the call site: only invoke the command when the variable is non-empty","Use shell parameter expansion with a default or error: \"${VAR:?autopilot id is required}\""],"exampleFix":"# before\nmultica autopilot info \"\"\n\n# after\nmultica autopilot info \"$AUTOPILOT_ID\"  # ensure AUTOPILOT_ID is set and non-empty","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(idArg) == \"\" {\n    return fmt.Errorf(\"%s id is required\", kind)\n}\n// only invoke the CLI when the id is present","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate CLI invocations on non-empty id variables","Quote shell variables and check them with test -n \"$VAR\" in wrappers"],"tags":["cli","validation","id-resolution","empty-input"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}