{"record":{"id":"539ca8089d7a1996","repo":"hashicorp/nomad","slug":"failed-to-parse-s-as-int-s","errorCode":null,"errorMessage":"Failed to parse %s as int: %s","messagePattern":"Failed to parse (.+?) as int: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/config/config.go","lineNumber":1033,"sourceCode":"// ReadBoolDefault tries to parse the specified option as a boolean. If there is\n// an error in parsing, the default option is returned.\nfunc (c *Config) ReadBoolDefault(id string, defaultValue bool) bool {\n\tval, err := c.ReadBool(id)\n\tif err != nil {\n\t\treturn defaultValue\n\t}\n\treturn val\n}\n\n// ReadInt parses the specified option as a int.\nfunc (c *Config) ReadInt(id string) (int, error) {\n\tval, ok := c.Options[id]\n\tif !ok {\n\t\treturn 0, fmt.Errorf(\"Specified config is missing from options\")\n\t}\n\tival, err := strconv.Atoi(val)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"Failed to parse %s as int: %s\", val, err)\n\t}\n\treturn ival, nil\n}\n\n// ReadIntDefault tries to parse the specified option as a int. If there is\n// an error in parsing, the default option is returned.\nfunc (c *Config) ReadIntDefault(id string, defaultValue int) int {\n\tval, err := c.ReadInt(id)\n\tif err != nil {\n\t\treturn defaultValue\n\t}\n\treturn val\n}\n\n// ReadDuration parses the specified option as a duration.\nfunc (c *Config) ReadDuration(id string) (time.Duration, error) {\n\tval, ok := c.Options[id]\n\tif !ok {","sourceCodeStart":1015,"sourceCodeEnd":1051,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/config/config.go#L1015-L1051","documentation":"Config.ReadInt parses a client option with strconv.Atoi; this error fires when the option value is present but not an integer. Callers using ReadIntDefault swallow the error and use the default instead.","triggerScenarios":"Thrown at client/config/config.go:1033 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the option value to a plain integer","Use ReadIntDefault to tolerate bad values","Reject non-numeric values during config validation"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}