{"record":{"id":"cfdb761f3ec971bd","repo":"JuliusBrussee/caveman","slug":"ccr-typed-object-dependencies-w","errorCode":null,"errorMessage":"ccr typed object dependencies: %w","messagePattern":"ccr typed object dependencies: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":499,"sourceCode":"\tcase errors.Is(err, sql.ErrNoRows):\n\t\treturn nil, ErrNotFound\n\tcase err != nil:\n\t\treturn nil, fmt.Errorf(\"ccr metadata get: %w\", err)\n\t}\n\treturn metadata, nil\n}\n\n// PutObject stores one immutable typed working-memory object. Repeated puts of\n// the same content-derived ID are idempotent; currentness changes use\n// SetObjectCurrentness so invalidation stays explicit.\nfunc (s *Store) PutObject(input Object) (string, error) {\n\tobj, err := prepareObject(input)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdeps, err := json.Marshal(obj.Dependencies)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"ccr typed object dependencies: %w\", err)\n\t}\n\tused, err := s.storageBytes()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"ccr typed object budget: %w\", err)\n\t}\n\tvar existingBytes int64\n\terr = s.db.QueryRow(`SELECT length(data)+length(dependencies_json) FROM typed_objects WHERE object_id=?`, obj.ID).Scan(&existingBytes)\n\tif errors.Is(err, sql.ErrNoRows) {\n\t\texistingBytes = 0\n\t} else if err != nil {\n\t\treturn \"\", fmt.Errorf(\"ccr typed object budget: %w\", err)\n\t}\n\tif used-existingBytes+int64(len(obj.Data)+len(deps)) > s.maxBytes {\n\t\treturn \"\", fmt.Errorf(\"ccr typed object put: %w\", ErrBudgetExceeded)\n\t}\n\tresult, err := s.db.Exec(\n\t\t`INSERT INTO typed_objects (\n\t\t object_id, object_type, content_hash, source, created_at, repository_state,","sourceCodeStart":481,"sourceCodeEnd":517,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/engine/ccr/store_sqlite.go#L481-L517","documentation":"Wraps the json.Marshal failure for an Object's Dependencies slice in PutObject. Marshaling a string slice virtually never fails, so this guards against pathological non-string content injected via type assertion or interface construction.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:499 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure Dependencies contains only plain strings","Sanitize the dependency list at its source before building the Object","Investigate the wrapped marshal error for the unsupported value"],"exampleFix":null,"handlingStrategy":"try-catch","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"}