{"record":{"id":"248344bcd7e4a1cd","repo":"JuliusBrussee/caveman","slug":"note-exceeds-4096-bytes","errorCode":null,"errorMessage":"note exceeds 4096 bytes","messagePattern":"note exceeds 4096 bytes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/internal/store/learn_experiment.go","lineNumber":93,"sourceCode":"\tLabel      string                `json:\"label\"`\n\tSinkID     string                `json:\"sink_id,omitempty\"`\n\tFixKind    string                `json:\"fix_kind,omitempty\"`\n\tArms       []ExperimentArmResult `json:\"arms\"`\n\tVerdict    string                `json:\"verdict\"`\n\tDeltaPct   *float64              `json:\"median_session_tokens_delta_pct,omitempty\"`\n\tSavedUSD   *float64              `json:\"saved_usd_per_session,omitempty\"`\n\tCurrency   string                `json:\"currency,omitempty\"`\n\tAttributed LearnAttribution      `json:\"attribution\"`\n\tCaveats    []string              `json:\"caveats\"`\n}\n\nfunc (s *Store) StartExperiment(label, sinkID, fixKind, note string) (Experiment, error) {\n\tlabel = strings.TrimSpace(label)\n\tif label == \"\" || len(label) > 128 {\n\t\treturn Experiment{}, fmt.Errorf(\"experiment label must be 1-128 bytes\")\n\t}\n\tif len(note) > 4096 {\n\t\treturn Experiment{}, fmt.Errorf(\"note exceeds 4096 bytes\")\n\t}\n\tnow := learnOutcomeClock().UTC().Format(time.RFC3339)\n\tresult, err := s.db.Exec(`INSERT INTO experiments (label, sink_id, fix_kind, note, created_at)\n\t\tVALUES (?, ?, ?, ?, ?)`, label, sinkID, fixKind, note, now)\n\tif err != nil {\n\t\treturn Experiment{}, fmt.Errorf(\"start experiment %q: %w\", label, err)\n\t}\n\tid, err := result.LastInsertId()\n\tif err != nil {\n\t\treturn Experiment{}, fmt.Errorf(\"read experiment id: %w\", err)\n\t}\n\tif _, err := s.db.Exec(`INSERT INTO experiment_arms (experiment_id, arm, started_at)\n\t\tVALUES (?, ?, ?)`, id, experimentArmOn, now); err != nil {\n\t\treturn Experiment{}, fmt.Errorf(\"open first arm: %w\", err)\n\t}\n\treturn s.LoadExperiment(label)\n}\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/81536f57b3303b7de7f5bc5b564cc344f9112d68/proxy/internal/store/learn_experiment.go#L75-L111","documentation":"StartExperiment found the supplied note longer than 4096 bytes. Notes are bounded free-text metadata; the guard rejects oversized notes before persisting experiment state so storage stays bounded.","triggerScenarios":"Thrown at proxy/internal/store/learn_experiment.go:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Shorten the note to at most 4096 bytes","Move long context into a linked artifact instead of the note field","Truncate programmatically generated notes before submission"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"81536f57b3303b7de7f5bc5b564cc344f9112d68","analyzedAt":"2026-08-27T02:25:50.681Z","contentChangedAt":"2026-08-27T02:25:50.681Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}