{"record":{"id":"062e19749026e8ab","repo":"dapr/dapr","slug":"error-parsing-dapr-grpc-port-flag-w","errorCode":null,"errorMessage":"error parsing dapr-grpc-port flag: %w","messagePattern":"error parsing dapr-grpc-port flag: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/config.go","lineNumber":417,"sourceCode":"\t}\n\n\tif intc.mode == modes.StandaloneMode {\n\t\terr := validation.ValidateSelfHostedAppID(intc.id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar err error\n\n\tintc.httpPort, err = strconv.Atoi(c.DaprHTTPPort)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing dapr-http-port flag: %w\", err)\n\t}\n\n\tintc.apiGRPCPort, err = strconv.Atoi(c.DaprAPIGRPCPort)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing dapr-grpc-port flag: %w\", err)\n\t}\n\n\tintc.profilePort, err = strconv.Atoi(c.ProfilePort)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing profile-port flag: %w\", err)\n\t}\n\n\tif c.DaprInternalGRPCPort != \"\" && c.DaprInternalGRPCPort != \"0\" {\n\t\tintc.internalGRPCPort, err = strconv.Atoi(c.DaprInternalGRPCPort)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing dapr-internal-grpc-port: %w\", err)\n\t\t}\n\t} else {\n\t\t// Get a \"stable random\" port in the range 47300-49,347 if it can be\n\t\t// acquired using a deterministic algorithm that returns the same value if\n\t\t// the same app is restarted\n\t\t// Otherwise, the port will be random.\n\t\tintc.internalGRPCPort, err = ports.GetStablePort(47300, intc.id)","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/dapr/dapr/blob/74ad41702745709bb15fe2114ff693b8c59bc3cc/pkg/runtime/config.go#L399-L435","documentation":"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.","triggerScenarios":"Passing --dapr-grpc-port \"50001.0\", \"\", or any non-integer string to daprd/dapr run.","commonSituations":"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.","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"],"exampleFix":"# before\ndapr run --app-id myapp --dapr-grpc-port 50001/grpc\n\n# after\ndapr run --app-id myapp --dapr-grpc-port 50001","handlingStrategy":"validation","validationCode":"if p := c.DaprAPIGRPCPort; p != \"\" {\n\tif _, err := strconv.Atoi(p); err != nil {\n\t\treturn fmt.Errorf(\"--dapr-grpc-port %q must be an integer\", p)\n\t}\n}","typeGuard":"func isIntPort(s string) bool {\n\tn, err := strconv.Atoi(strings.TrimSpace(s))\n\treturn err == nil && n >= 0 && n <= 65535\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["go","dapr","flags","ports","startup"],"backgroundTag":null,"analyzedSha":"74ad41702745709bb15fe2114ff693b8c59bc3cc","analyzedAt":"2026-08-16T04:22:26.543Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}