{"record":{"id":"db4af63218ff3f57","repo":"JuliusBrussee/caveman","slug":"proposalrun-canonicalize-detail-w","errorCode":null,"errorMessage":"proposalrun: canonicalize detail: %w","messagePattern":"proposalrun: canonicalize detail: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/proposalrun/proposalrun.go","lineNumber":75,"sourceCode":"\tif len(detail) == 0 {\n\t\treturn []byte(\"{}\"), nil\n\t}\n\tvar v any\n\tdec := json.NewDecoder(bytes.NewReader(detail))\n\tdec.UseNumber()\n\tif err := dec.Decode(&v); err != nil {\n\t\treturn nil, fmt.Errorf(\"proposalrun: detail is not valid JSON: %w\", err)\n\t}\n\tvar trailing any\n\tif err := dec.Decode(&trailing); err != io.EOF {\n\t\tif err == nil {\n\t\t\treturn nil, fmt.Errorf(\"proposalrun: detail contains trailing JSON\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"proposalrun: detail contains trailing data: %w\", err)\n\t}\n\tv, err := canonicalizeJSONValue(v)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"proposalrun: canonicalize detail: %w\", err)\n\t}\n\tout, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"proposalrun: marshal canonical detail: %w\", err)\n\t}\n\treturn out, nil\n}\n\n// PostgreSQL jsonb stores JSON numbers using its numeric type. These are the\n// documented numeric bounds (131072 digits before and 16383 after the decimal\n// point); rejecting at the canonicalization boundary keeps write and read-back\n// hashing deterministic and avoids unbounded strings from hostile exponents.\n// maxJSONBNumberExponent is an additional allocation guard. PostgreSQL can\n// accept some zero literals with a larger positive exponent after normalizing\n// their zero weight; this package rejects those spellings conservatively so a\n// hostile exponent never drives unbounded intermediate arithmetic.\nconst (\n\tmaxJSONBNumericIntegerDigits  = 131072","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shared/platform/proposalrun/proposalrun.go#L57-L93","documentation":"Error \"proposalrun: canonicalize detail: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shared/platform/proposalrun/proposalrun.go:75 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix detail canonicalization (non-serializable values) and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}