{"record":{"id":"6ec14855abfd839b","repo":"dapr/dapr","slug":"error-parsing-dapr-http-port-flag-w","errorCode":null,"errorMessage":"error parsing dapr-http-port flag: %w","messagePattern":"error parsing dapr-http-port flag: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/config.go","lineNumber":412,"sourceCode":"\t\tworkflowEventSink:          c.WorkflowEventSink,\n\t}\n\n\tif len(intc.standalone.ResourcesPath) == 0 && c.ComponentsPath != \"\" {\n\t\tintc.standalone.ResourcesPath = []string{c.ComponentsPath}\n\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 {","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/dapr/dapr/blob/74ad41702745709bb15fe2114ff693b8c59bc3cc/pkg/runtime/config.go#L394-L430","documentation":"strconv.Atoi failed on the --dapr-http-port flag value during runtime config init (pkg/runtime/config.go:412). The sidecar HTTP API port must be a base-10 integer; anything else (empty string, float, unit suffix, letters) aborts startup.","triggerScenarios":"Passing --dapr-http-port with a non-integer such as \"\", \"3500.0\", \"3500/tcp\", or \"http\" — often caused by an unset env var interpolated into a launcher script.","commonSituations":"dapr run / daprd launched from CI or docker where the port comes from an environment variable that is unset (renders empty); typos in flags; templates appending units.","solutions":["Pass a plain integer for --dapr-http-port (default 3500)","If the value comes from an env var, verify it is set and numeric before launching (echo \"$DAPR_HTTP_PORT\")","Inspect the rendered command line in the crash log and remove stray characters/units"],"exampleFix":"# before\nDAPR_HTTP_PORT=${HTTP_PORT} ./daprd --dapr-http-port \"${HTTP_PORT} \"  # unset -> empty\n\n# after\nDAPR_HTTP_PORT=${HTTP_PORT:-3500} ./daprd --dapr-http-port \"${DAPR_HTTP_PORT:-3500}\"","handlingStrategy":"validation","validationCode":"func validatePortFlags(c runtime.Config) error {\n\tfor name, v := range map[string]string{\n\t\t\"dapr-http-port\": c.DaprHTTPPort,\n\t\t\"dapr-grpc-port\": c.DaprAPIGRPCPort,\n\t\t\"profile-port\":  c.ProfilePort,\n\t} {\n\t\tif _, err := strconv.Atoi(v); err != nil {\n\t\t\treturn fmt.Errorf(\"flag %s=%q is not an integer\", name, v)\n\t\t}\n\t}\n\treturn nil\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":["Default port env vars in launch scripts: ${DAPR_HTTP_PORT:-3500}","Assert every *_PORT variable is numeric before invoking dapr/daprd","Keep ports as integers end-to-end; never interpolate with units or whitespace"],"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"}