{"record":{"id":"c6dc427203de5b7c","repo":"JuliusBrussee/caveman","slug":"ccr-typed-object-id-collision","errorCode":null,"errorMessage":"ccr: typed object id collision","messagePattern":"ccr: typed object id collision","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":542,"sourceCode":"\t\tobj.Lifecycle, string(deps), obj.OriginalByteLength, obj.StoredByteLength, obj.Data,\n\t)\n\tif err != nil {\n\t\tif isFull(err) {\n\t\t\treturn \"\", fmt.Errorf(\"ccr typed object put: %w\", ErrBudgetExceeded)\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"ccr typed object put: %w\", err)\n\t}\n\tinserted, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"ccr typed object put rows: %w\", err)\n\t}\n\tif inserted == 0 {\n\t\texisting, err := s.GetObject(obj.ID)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"ccr typed object collision lookup: %w\", err)\n\t\t}\n\t\tif !sameImmutableObject(existing, obj) {\n\t\t\treturn \"\", errors.New(\"ccr: typed object id collision\")\n\t\t}\n\t}\n\treturn obj.ID, nil\n}\n\nfunc scanObject(scanner interface{ Scan(...any) error }) (Object, error) {\n\tvar obj Object\n\tvar created, deps string\n\tif err := scanner.Scan(\n\t\t&obj.ID, &obj.Type, &obj.ContentHash, &obj.Source, &created, &obj.RepositoryState,\n\t\t&obj.SessionID, &obj.TransformVersion, &obj.Currentness, &obj.Lifecycle, &deps,\n\t\t&obj.OriginalByteLength, &obj.StoredByteLength, &obj.Data,\n\t); err != nil {\n\t\treturn Object{}, err\n\t}\n\tparsed, err := time.Parse(time.RFC3339Nano, created)\n\tif err != nil {\n\t\treturn Object{}, fmt.Errorf(\"ccr typed object created_at: %w\", err)","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/engine/ccr/store_sqlite.go#L524-L560","documentation":"PutObject's INSERT was a no-op (0 rows) and the pre-existing object under the same ID is not immutably identical (sameImmutableObject false). Object IDs are content-derived, so a different body under an existing ID means a hash collision or non-deterministic ID assignment.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:542 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure object IDs are derived only from the immutable fields used in the ID computation","Avoid reusing an ID for evolving content — store a new version with a new ID"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}