{"record":{"id":"5d8fd4fc48de684a","repo":"JuliusBrussee/caveman","slug":"ccr-task-decision-find-w","errorCode":null,"errorMessage":"ccr task decision find: %w","messagePattern":"ccr task decision find: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":659,"sourceCode":"\t\treturn nil, fmt.Errorf(\"ccr typed object list rows: %w\", err)\n\t}\n\treturn objects, nil\n}\n\n// FindTaskDecision returns one Decision Ledger object by its stable decision\n// ID. Callers still validate the versioned decision schema before rendering it.\nfunc (s *Store) FindTaskDecision(decisionID string) (Object, error) {\n\tobj, err := scanObject(s.db.QueryRow(\n\t\t`SELECT `+objectColumns+` FROM typed_objects\n\t\t WHERE object_type = ? AND json_extract(CAST(data AS TEXT), '$.decision_id') = ?\n\t\t ORDER BY created_at DESC, object_id DESC LIMIT 1`,\n\t\tObjectTaskDecision, decisionID,\n\t))\n\tif errors.Is(err, sql.ErrNoRows) {\n\t\treturn Object{}, ErrNotFound\n\t}\n\tif err != nil {\n\t\treturn Object{}, fmt.Errorf(\"ccr task decision find: %w\", err)\n\t}\n\treturn obj, nil\n}\n\n// Summary aggregates stored recoveries into totals + per-content-type buckets.\nfunc (s *Store) Summary() (Stats, error) {\n\tout := Stats{ByContentType: map[string]Bucket{}, Basis: \"inferred\"}\n\trows, err := s.db.Query(\n\t\t`SELECT content_type, COUNT(*), COALESCE(SUM(tokens_before),0), COALESCE(SUM(tokens_after),0)\n\t\t FROM recoveries GROUP BY content_type`)\n\tif err != nil {\n\t\treturn out, fmt.Errorf(\"ccr summary: %w\", err)\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar ct string\n\t\tvar b Bucket\n\t\tif err := rows.Scan(&ct, &b.Count, &b.TokensBefore, &b.TokensAfter); err != nil {","sourceCodeStart":641,"sourceCodeEnd":677,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/engine/ccr/store_sqlite.go#L641-L677","documentation":"Wraps the SELECT failure in Store.FindTaskDecision when looking up a Decision Ledger object by decision id via json_extract. Distinguishable from not-found (ErrNotFound); fires when the query itself errors, e.g. locked or corrupt database.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:659 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped driver error","Retry the lookup after contention clears","Verify the typed_objects table and its JSON1 functions are available"],"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-14T05:17:10.506Z"}