{"record":{"id":"c04ae747cb5a0f4f","repo":"multica-ai/multica","slug":"resource-ref-is-required","errorCode":null,"errorMessage":"resource_ref is required","messagePattern":"resource_ref is required","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/internal/handler/project_resource.go","lineNumber":73,"sourceCode":"\tPosition     *int32          `json:\"position\"`\n}\n\n// UpdateProjectResourceRequest is the body for PUT /api/projects/{id}/resources/{resourceId}.\n// resource_type cannot change after creation — pick a new type by deleting and\n// re-adding. Every field is optional; omitted fields keep their current value.\ntype UpdateProjectResourceRequest struct {\n\tResourceRef json.RawMessage `json:\"resource_ref\"`\n\tLabel       *string         `json:\"label\"`\n\tPosition    *int32          `json:\"position\"`\n}\n\n// validateAndNormalizeResourceRef checks the payload for a known resource_type.\n// New types are added here without schema migration; unknown types are rejected\n// at the API boundary so a typo can't slip through and produce a resource the\n// daemon/UI doesn't understand.\nfunc validateAndNormalizeResourceRef(resourceType string, ref json.RawMessage) (json.RawMessage, error) {\n\tif len(ref) == 0 {\n\t\treturn nil, errors.New(\"resource_ref is required\")\n\t}\n\tswitch resourceType {\n\tcase \"github_repo\":\n\t\treturn validateGithubRepoRef(ref)\n\tcase \"local_directory\":\n\t\treturn validateLocalDirectoryRef(ref)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown resource_type %q\", resourceType)\n\t}\n}\n\ntype githubRepoRef struct {\n\tURL               string `json:\"url\"`\n\tDefaultBranchHint string `json:\"default_branch_hint,omitempty\"`\n\tRef               string `json:\"ref,omitempty\"`\n}\n\nfunc validateGithubRepoRef(ref json.RawMessage) (json.RawMessage, error) {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/handler/project_resource.go#L55-L91","documentation":"Error \"resource_ref is required\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/handler/project_resource.go:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include a resource_ref payload appropriate for 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"}