{"record":{"id":"4de6074624f36466","repo":"slimtoolkit/slim","slug":"invalid-http-probe-command-port-v","errorCode":null,"errorMessage":"invalid HTTP probe command port: %v","messagePattern":"invalid HTTP probe command port: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/command/clifvparser.go","lineNumber":695,"sourceCode":"\t\t\t\treturn nil, fmt.Errorf(\"invalid HTTP probe command protocol: %+v\", cmd)\n\t\t\t}\n\n\t\t\tif cmd.Method != \"\" && !isMethod(cmd.Method) {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid HTTP probe command method: %+v\", cmd)\n\t\t\t}\n\n\t\t\tif cmd.Method == \"\" {\n\t\t\t\tcmd.Method = \"GET\"\n\t\t\t}\n\n\t\t\tcmd.Method = strings.ToUpper(cmd.Method)\n\n\t\t\tif cmd.Resource == \"\" || !isResource(cmd.Resource) {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid HTTP probe command resource: %+v\", cmd)\n\t\t\t}\n\n\t\t\tif cmd.Port != 0 && !isPortNum(cmd.Port) {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid HTTP probe command port: %v\", cmd)\n\t\t\t}\n\n\t\t\tif cmd.BodyFile != \"\" {\n\t\t\t\tbfFullPath, err := filepath.Abs(cmd.BodyFile)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\t_, err = os.Stat(bfFullPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\n\t\t\t\tcmd.BodyFile = bfFullPath\n\n\t\t\t\t//the body data file should be ok to load\n\t\t\t\t//will load the data at runtime\n\t\t\t}","sourceCodeStart":677,"sourceCodeEnd":713,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/command/clifvparser.go#L677-L713","documentation":"In ParseHTTPProbesFile, a command with a non-zero Port must pass isPortNum (a valid port number, typically 1-65535). Out-of-range or nonsensical port values cause the loader to fail with this error.","triggerScenarios":"GetHTTPProbes loading a probe config JSON where commands[].port is set to 0 is allowed (treated as unset), but e.g. 70000, -1, or 99999 fails isPortNum.","commonSituations":"Oversized ports from merging service configs, negative numbers from scripted generation, or confusing container-internal vs published ports.","solutions":["Set commands[].port to a value in 1-65535","Omit port (or leave 0) to use the protocol default (80/443)","Clamp/validate port values in the tooling that generates the JSON file"],"exampleFix":"// before (probe file JSON)\n{\"commands\":[{\"resource\":\"/\",\"port\":70000}]}\n// after\n{\"commands\":[{\"resource\":\"/\",\"port\":8443}]}","handlingStrategy":"validation","validationCode":"for _, c := range cmds.Commands {\n    if c.Port != 0 && (c.Port < 1 || c.Port > 65535) {\n        return fmt.Errorf(\"command %v: port must be 1-65535\", c)\n    }\n}","typeGuard":"func isValidPort(p int) bool { return p == 0 || (p >= 1 && p <= 65535) }","tryCatchPattern":"probes, err := ParseHTTPProbesFile(path)\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid HTTP probe command port\") {\n        return nil, fmt.Errorf(\"port out of range in %s: %w\", path, err)\n    }\n    return nil, err\n}","preventionTips":["Keep ports within 1-65535","Leave port 0 to use protocol defaults","Clamp ports in config-generation tooling"],"tags":["http","json","validation","ports"],"backgroundTag":"invalid-http-probe-command","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}