{"record":{"id":"b69f71c8f0979cc0","repo":"JuliusBrussee/caveman","slug":"ccr-typed-object-put-w","errorCode":null,"errorMessage":"ccr typed object put: %w","messagePattern":"ccr typed object put: %w","errorType":"exception","errorClass":"ErrBudgetExceeded","httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":513,"sourceCode":"\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,\n\t\t session_id, transform_version, currentness, lifecycle, dependencies_json,\n\t\t original_byte_length, stored_byte_length, data\n\t\t) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)\n\t\tON CONFLICT(object_id) DO NOTHING`,\n\t\tobj.ID, obj.Type, obj.ContentHash, obj.Source, obj.CreatedAt.Format(time.RFC3339Nano),\n\t\tobj.RepositoryState, obj.SessionID, obj.TransformVersion, obj.Currentness,\n\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}","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/engine/ccr/store_sqlite.go#L495-L531","documentation":"Wraps either the existing-row size SELECT or the INSERT failure inside PutObject, including the full-disk/budget-full remap to ErrBudgetExceeded. It means the typed object could not be stored under the configured budget or the write itself failed.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:513 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["If the wrapped error is ErrBudgetExceeded, archive or evict old objects to free budget, or raise CAVEMAN_CCR_MAX_BYTES","Check for locks from concurrent writers and retry","Reduce the object's stored size (shorter data payload)"],"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"}