dapr/dapr · error
error parsing dapr-grpc-port flag: %w
Error message
error parsing dapr-grpc-port flag: %w
What it means
strconv.Atoi failed on the --dapr-grpc-port flag value (pkg/runtime/config.go:417). The sidecar gRPC API port must be a base-10 integer; a non-numeric value aborts runtime config init with the parse error wrapped.
Source
Thrown at pkg/runtime/config.go:417
}
if intc.mode == modes.StandaloneMode {
err := validation.ValidateSelfHostedAppID(intc.id)
if err != nil {
return nil, err
}
}
var err error
intc.httpPort, err = strconv.Atoi(c.DaprHTTPPort)
if err != nil {
return nil, fmt.Errorf("error parsing dapr-http-port flag: %w", err)
}
intc.apiGRPCPort, err = strconv.Atoi(c.DaprAPIGRPCPort)
if err != nil {
return nil, fmt.Errorf("error parsing dapr-grpc-port flag: %w", err)
}
intc.profilePort, err = strconv.Atoi(c.ProfilePort)
if err != nil {
return nil, fmt.Errorf("error parsing profile-port flag: %w", err)
}
if c.DaprInternalGRPCPort != "" && c.DaprInternalGRPCPort != "0" {
intc.internalGRPCPort, err = strconv.Atoi(c.DaprInternalGRPCPort)
if err != nil {
return nil, fmt.Errorf("error parsing dapr-internal-grpc-port: %w", err)
}
} else {
// Get a "stable random" port in the range 47300-49,347 if it can be
// acquired using a deterministic algorithm that returns the same value if
// the same app is restarted
// Otherwise, the port will be random.
intc.internalGRPCPort, err = ports.GetStablePort(47300, intc.id)View on GitHub (pinned to 74ad417027)
Solutions
- Pass a plain integer for --dapr-grpc-port (default 50001)
- Verify the env/source variable feeding the flag is set and numeric
- Check the full daprd command line in logs for a malformed value
Example fix
# before dapr run --app-id myapp --dapr-grpc-port 50001/grpc # after dapr run --app-id myapp --dapr-grpc-port 50001
Defensive patterns
Strategy: validation
Validate before calling
if p := c.DaprAPIGRPCPort; p != "" {
if _, err := strconv.Atoi(p); err != nil {
return fmt.Errorf("--dapr-grpc-port %q must be an integer", p)
}
} Type guard
func isIntPort(s string) bool {
n, err := strconv.Atoi(strings.TrimSpace(s))
return err == nil && n >= 0 && n <= 65535
} Prevention
- Pass the default 50001 explicitly in scripts that template ports
- Validate rendered helm/k8s values for port annotations with a numeric regex
- Echo the final daprd command line in CI logs to catch mangled flags
When it happens
Trigger: Passing --dapr-grpc-port "50001.0", "", or any non-integer string to daprd/dapr run.
Common situations: Env-var interpolation of an unset or malformed port in launch scripts; copying a port value with whitespace from docs; duplicated flags where the last wins and is invalid.
Related errors
- error parsing dapr-http-port flag: %w
- error parsing profile-port flag: %w
- error parsing dapr-internal-grpc-port: %w
- error parsing dapr-public-port: %w
- error parsing app-port: %w
AI-assisted analysis of dapr/dapr@74ad417027 (2026-08-16).
Data as JSON: /api/errors/062e19749026e8ab.
Report an issue: GitHub.