{"record":{"id":"c5a17b99b4b27f23","repo":"gastownhall/beads","slug":"prime-max-memory-chars-must-be-a-non-negative-inte","errorCode":null,"errorMessage":"prime.max-memory-chars must be a non-negative integer (0 = unlimited), got %q","messagePattern":"prime\\.max-memory-chars must be a non-negative integer \\(0 = unlimited\\), got %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/config/yaml_config.go","lineNumber":914,"sourceCode":"\t\t\treturn fmt.Errorf(\"dolt.debug must be \\\"true\\\" or \\\"false\\\", got %q\", value)\n\t\t}\n\tcase \"dolt.mode\":\n\t\tlower := strings.ToLower(value)\n\t\tif lower != \"server\" && lower != \"embedded\" {\n\t\t\treturn fmt.Errorf(\"dolt.mode must be \\\"server\\\" or \\\"embedded\\\", got %q\", value)\n\t\t}\n\tcase \"prime.max-memories\":\n\t\tn, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"prime.max-memories must be a non-negative integer (0 = unlimited), got %q\", value)\n\t\t}\n\t\tif n < 0 {\n\t\t\treturn fmt.Errorf(\"prime.max-memories must be a non-negative integer (0 = unlimited), got %q\", value)\n\t\t}\n\tcase \"prime.max-memory-chars\":\n\t\tn, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"prime.max-memory-chars must be a non-negative integer (0 = unlimited), got %q\", value)\n\t\t}\n\t\tif n < 0 {\n\t\t\treturn fmt.Errorf(\"prime.max-memory-chars must be a non-negative integer (0 = unlimited), got %q\", value)\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":896,"sourceCodeEnd":922,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/config/yaml_config.go#L896-L922","documentation":"When setting prime.max-memory-chars, validateYamlConfigValue parses the value with strconv.Atoi; a non-integer string fails and returns this error. The value caps primed memory content in characters, with 0 meaning unlimited.","triggerScenarios":"`bd config set prime.max-memory-chars \"10k\"` or any non-integer string via SetYamlConfig/SetYamlConfigInDir/SetUserYamlConfig (Atoi error branch at yaml_config.go:914).","commonSituations":"Values with suffixes like \"20000k\", decimals, or quoted/whitespace-polluted shell values.","solutions":["Pass a plain non-negative integer, e.g. `bd config set prime.max-memory-chars 20000`","Use 0 for unlimited","Convert unit suffixes to full integers before setting"],"exampleFix":"// before\nSetYamlConfig(\"prime.max-memory-chars\", \"20k\")\n// after\nSetYamlConfig(\"prime.max-memory-chars\", \"20000\")","handlingStrategy":"validation","validationCode":"n, err := strconv.Atoi(strings.TrimSpace(value))\nif err != nil || n < 0 {\n    return fmt.Errorf(\"prime.max-memory-chars must be a non-negative integer, got %q\", value)\n}","typeGuard":null,"tryCatchPattern":"if err := bd.SetYamlConfig(\"prime.max-memory-chars\", v); err != nil {\n    log.Printf(\"rejected: %v\", err)\n    return err\n}","preventionTips":["Convert suffixes (k, M) to full integers before setting","Use 0 for unlimited rather than symbolic strings","Validate all numeric config from untrusted inputs"],"tags":["config","validation","integer-parsing"],"backgroundTag":"invalid-config-value","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}