JuliusBrussee/caveman · error
record applied fix: %w
Error message
record applied fix: %w
What it means
The INSERT of the applied-fix record into the database failed after validation and JSON encoding succeeded. Database-level failure: locked/corrupt DB, disk error, or schema mismatch in the applied-fix table.
Source
Thrown at proxy/internal/store/learn_outcomes.go:110
if err != nil {
return AppliedFixRecord{}, fmt.Errorf("encode before evidence: %w", err)
}
// Fingerprint the edited artifact as it stands NOW — which at
// `caveman learn applied` time is immediately after the approved edit. This
// is the provenance anchor: a later scan re-hashes the same path and can
// state whether the change we proposed is still the change that is there.
target := fingerprintFixTarget(*sink)
targetJSON := ""
if target != nil {
if encoded, encodeErr := json.Marshal(target); encodeErr == nil {
targetJSON = string(encoded)
}
}
result, err := s.db.Exec(`INSERT INTO applied_fixes
(sink_id, practice_id, fix_kind, applied_at, before_tokens_per_turn, before_evidence_json, note, target_json)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, sink.SinkID, sink.PracticeID, fixKind, appliedAt, sink.TokensPerTurn, string(evidence), note, targetJSON)
if err != nil {
return AppliedFixRecord{}, fmt.Errorf("record applied fix: %w", err)
}
id, err := result.LastInsertId()
if err != nil {
return AppliedFixRecord{}, fmt.Errorf("read applied fix id: %w", err)
}
return AppliedFixRecord{
Recorded: true, ID: id, SinkID: sink.SinkID, PracticeID: sink.PracticeID,
FixKind: fixKind, AppliedAt: appliedAt, BeforeTokensPerTurn: sink.TokensPerTurn,
BeforeEvidence: beforeEvidence, BeforeSource: beforeSource, Note: note,
Target: target,
}, nil
}
func beforeSinkForAppliedFix(plan LearnPlan, sinkID string, live *Sink, fallbackCutoff time.Time) (*Sink, string) {
cutoff := fallbackCutoff
if parsed, err := time.Parse(time.RFC3339Nano, plan.computedAt); err == nil {
cutoff = parsed
}View on GitHub (pinned to 81536f57b3)
Solutions
- Check the SQLite database is writable and not locked by another process
- Inspect the wrapped driver error for the root cause
- Verify the applied-fix table schema matches the INSERT
- Re-run the learn applied command once the database is available
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at proxy/internal/store/learn_outcomes.go:110 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@81536f57b3 (2026-08-27).
Data as JSON: /api/errors/9242496aec7a5f65.
Report an issue: GitHub.