{"record":{"id":"dcee4643bc464ca6","repo":"multica-ai/multica","slug":"resolve-s-w","errorCode":null,"errorMessage":"resolve %s: %w","messagePattern":"resolve (.+?): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_id_resolver.go","lineNumber":87,"sourceCode":"\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 == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(compactUUID(c.ID), prefix) {\n\t\t\tmatches = append(matches, c)\n\t\t}\n\t}\n\n\tswitch len(matches) {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_id_resolver.go#L69-L105","documentation":"Wrapper error from resolveIDByPrefix that contextualizes a normalizeUUIDPrefix failure with the resource kind (\"resolve label: ...\"). It propagates the underlying too-short or non-hex prefix error while telling the user which resource resolution failed.","triggerScenarios":"Any prefix resolution where the raw input fails normalizeUUIDPrefix: fewer than 4 hex chars after dash-stripping, or non-hex characters. The wrapped error is one of the \"expected a full UUID or at least N hex characters\" or \"only hex characters\" messages.","commonSituations":"Same as the underlying prefix format errors: truncated ids, wrong-format keys, or values with stray characters; the kind prefix helps identify which of several id arguments was malformed.","solutions":["Read the wrapped message after the colon — it states the exact format problem — and fix the id accordingly","Pass the full UUID obtained from the list command with --full-id","Validate ids in scripts before invoking the CLI (length >= 4, hex-only after removing dashes)"],"exampleFix":"# before\nmultica label rm \"zz\"\n# error: resolve label: expected a full UUID or at least 4 hex characters, got \"zz\"\n\n# after\nmultica label rm \"a1b2c3\"","handlingStrategy":"try-catch","validationCode":"// pre-normalize exactly like the CLI does to catch format errors early\nif _, err := normalizeUUIDPrefix(input); err != nil {\n    return fmt.Errorf(\"fix id %q before calling the CLI: %w\", input, err)\n}","typeGuard":null,"tryCatchPattern":"// In Go code wrapping the CLI: unwrap with errors.Is/As to distinguish\n// prefix-format failures from fetch failures, and surface the kind context.\nif err := resolveIDByPrefix(ctx, client, kind, input, fetch); err != nil {\n    var formatErr *PrefixFormatError\n    if errors.As(err, &formatErr) {\n        // user-input problem: prompt for a corrected id\n    } else {\n        // transport/server problem: retry or report connectivity\n    }\n}","preventionTips":["Treat 'resolve <kind>:' messages as wrappers; always read the wrapped cause after the colon","Run ids through the same normalization rules (trim, lowercase, strip dashes, hex-check) client-side"],"tags":["cli","validation","id-resolution","error-wrapping"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}