{"record":{"id":"76b048b12b7c2472","repo":"multica-ai/multica","slug":"ref-must-be-a-json-resource-ref-payload-for-reso","errorCode":null,"errorMessage":"--ref must be a JSON resource_ref payload for resource type %q","messagePattern":"--ref must be a JSON resource_ref payload for resource type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_project.go","lineNumber":776,"sourceCode":"\t}\n\trawRef, _ := cmd.Flags().GetString(\"ref\")\n\trawRef = strings.TrimSpace(rawRef)\n\t// --ref is the generic JSON resource_ref escape hatch. For github_repo it\n\t// does double duty: a JSON object/array (\"{...}\" / \"[...]\") is still the\n\t// escape hatch, but any other value — including bare scalars like a numeric\n\t// tag (\"2024\") or an all-digit short SHA (\"1234567\") — is a checkout-ref\n\t// shortcut that merges with --url. Only parse JSON when the value is\n\t// actually meant as JSON; otherwise json.Unmarshal would accept \"2024\" as a\n\t// number and silently swallow a legitimate checkout ref.\n\tif rawRef != \"\" && (resourceType != \"github_repo\" || looksLikeJSONPayload(rawRef)) {\n\t\tvar ref any\n\t\tif err := json.Unmarshal([]byte(rawRef), &ref); err != nil {\n\t\t\treturn nil, false, fmt.Errorf(\"--ref is not valid JSON: %w\", err)\n\t\t}\n\t\treturn ref, true, nil\n\t}\n\tif resourceType != \"github_repo\" {\n\t\treturn nil, false, fmt.Errorf(\"--ref must be a JSON resource_ref payload for resource type %q\", resourceType)\n\t}\n\tref, has, err := buildResourceRefFromFlags(cmd, resourceType, existingRef)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\treturn ref, has, nil\n}\n\nfunc looksLikeJSONPayload(raw string) bool {\n\traw = strings.TrimSpace(raw)\n\treturn strings.HasPrefix(raw, \"{\") || strings.HasPrefix(raw, \"[\")\n}\n\n// buildResourceRefFromFlags collects the per-type shortcut flags into a\n// resource_ref payload, seeding from existingRef so partial edits (only\n// --default-branch-hint, only --ref-label) preserve the unmentioned fields.\n// Returns (ref, true) only when the caller actually set at least one shortcut\n// flag — that lets the update command tell \"no change requested\" apart from","sourceCodeStart":758,"sourceCodeEnd":794,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_project.go#L758-L794","documentation":"Error \"--ref must be a JSON resource_ref payload for resource type %q\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/cmd/multica/cmd_project.go:776 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a JSON resource_ref payload matching the resource type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}