slimtoolkit/slim · error
invalid HTTP probe command port: %v
Error message
invalid HTTP probe command port: %v
What it means
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.
Source
Thrown at pkg/app/master/command/clifvparser.go:695
return nil, fmt.Errorf("invalid HTTP probe command protocol: %+v", cmd)
}
if cmd.Method != "" && !isMethod(cmd.Method) {
return nil, fmt.Errorf("invalid HTTP probe command method: %+v", cmd)
}
if cmd.Method == "" {
cmd.Method = "GET"
}
cmd.Method = strings.ToUpper(cmd.Method)
if cmd.Resource == "" || !isResource(cmd.Resource) {
return nil, fmt.Errorf("invalid HTTP probe command resource: %+v", cmd)
}
if cmd.Port != 0 && !isPortNum(cmd.Port) {
return nil, fmt.Errorf("invalid HTTP probe command port: %v", cmd)
}
if cmd.BodyFile != "" {
bfFullPath, err := filepath.Abs(cmd.BodyFile)
if err != nil {
return nil, err
}
_, err = os.Stat(bfFullPath)
if err != nil {
return nil, err
}
cmd.BodyFile = bfFullPath
//the body data file should be ok to load
//will load the data at runtime
}View on GitHub (pinned to 81940d17fa)
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
Example fix
// before (probe file JSON)
{"commands":[{"resource":"/","port":70000}]}
// after
{"commands":[{"resource":"/","port":8443}]} Defensive patterns
Strategy: validation
Validate before calling
for _, c := range cmds.Commands {
if c.Port != 0 && (c.Port < 1 || c.Port > 65535) {
return fmt.Errorf("command %v: port must be 1-65535", c)
}
} Type guard
func isValidPort(p int) bool { return p == 0 || (p >= 1 && p <= 65535) } Try / catch
probes, err := ParseHTTPProbesFile(path)
if err != nil {
if strings.Contains(err.Error(), "invalid HTTP probe command port") {
return nil, fmt.Errorf("port out of range in %s: %w", path, err)
}
return nil, err
} Prevention
- Keep ports within 1-65535
- Leave port 0 to use protocol defaults
- Clamp ports in config-generation tooling
When it happens
Trigger: 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.
Common situations: Oversized ports from merging service configs, negative numbers from scripted generation, or confusing container-internal vs published ports.
Related errors
- invalid HTTP probe command: %s
- podPort cannot be empty
- unexpected HTTP status code
- file path is not absolute
- file is not a binary
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/4de6074624f36466.
Report an issue: GitHub.