{"record":{"id":"d771cf018e7ac7c7","repo":"dapr/dapr","slug":"failed-to-parse-default-actor-idle-timeout-s","errorCode":null,"errorMessage":"failed to parse default actor idle timeout: %s","messagePattern":"failed to parse default actor idle timeout: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/actors/actors.go","lineNumber":465,"sourceCode":"\t\t}\n\t}\n\n\tdrainOngoingCallTimeout := api.DefaultOngoingCallTimeout\n\tif len(cfg.DrainOngoingCallTimeout) > 0 {\n\t\tvar err error\n\t\tdrainOngoingCallTimeout, err = time.ParseDuration(cfg.DrainOngoingCallTimeout)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse drain ongoing call timeout: %s\", err)\n\t\t}\n\t\tdrainOngoingCallTimeout = api.ClampDrainOngoingCallTimeout(drainOngoingCallTimeout, a.disseminationTimeout, \"global config\")\n\t}\n\n\tidleTimeout := api.DefaultIdleTimeout\n\tif len(cfg.DefaultIdleTimeout) > 0 {\n\t\tvar err error\n\t\tidleTimeout, err = time.ParseDuration(cfg.DefaultIdleTimeout)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse default actor idle timeout: %s\", err)\n\t\t}\n\t}\n\n\treentrancy := cfg.Reentrancy\n\tif reentrancy.MaxStackDepth == nil {\n\t\treentrancy.MaxStackDepth = ptr.Of(api.DefaultReentrancyStackLimit)\n\t}\n\n\tfactories := make([]table.ActorTypeFactory, 0, len(cfg.HostedActorTypes))\n\tfor _, actorType := range cfg.HostedActorTypes {\n\t\tidleTimeout := idleTimeout\n\t\treentrancy := reentrancy\n\t\tif c, ok := entityConfigs[actorType]; ok {\n\t\t\tidleTimeout = c.ActorIdleTimeout\n\t\t\treentrancy = c.ReentrancyConfig\n\t\t}\n\n\t\tfactories = append(factories, table.ActorTypeFactory{","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/dapr/dapr/blob/74ad41702745709bb15fe2114ff693b8c59bc3cc/pkg/actors/actors.go#L447-L483","documentation":"The actors runtime reads the default idle timeout as a string (cfg.DefaultIdleTimeout, sourced from the app's actor configuration served at /dapr/config, field actorIdleTimeout). It converts the string with Go's time.ParseDuration. If the string is not a valid Go duration, actors Init fails and the runtime stops. Valid values look like \"1h\", \"30m\", or \"1h30m\".","triggerScenarios":"The app's /dapr/config response sets actorIdleTimeout (or an embedded runtime sets Config.DefaultIdleTimeout) to a string time.ParseDuration rejects: \"1hour\", \"30 minutes\", \"1 h\", \"3600\" (no unit), or an ISO-8601 value like \"PT1H\". Init returns this error before any actor type registers.","commonSituations":"A developer writes a human-readable unit in YAML or code. A value is copied from a system that uses ISO durations. An SDK sends a bare number. The same block also parses drainOngoingCallTimeout, so a typo in either field fails startup.","solutions":["Set actorIdleTimeout to a valid Go duration string: \"1h\", \"45m\", or \"1h30m\".","Use only the units ns, us, ms, s, m, h. No spaces, no days, no years.","Omit the field to accept the default of 1h.","Check drainOngoingCallTimeout and per-entity idle timeouts in the same config. They use the same parser and fail the same way."],"exampleFix":"// before: app serves GET /dapr/config\n{\"entities\":[\"MyActor\"],\"actorIdleTimeout\":\"1hour\"}\n\n// after\n{\"entities\":[\"MyActor\"],\"actorIdleTimeout\":\"1h\"}","handlingStrategy":"validation","validationCode":"func validateActorConfig(idleTimeout, drainTimeout string) error {\n\tif idleTimeout != \"\" {\n\t\tif _, err := time.ParseDuration(idleTimeout); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid actorIdleTimeout %q: %w\", idleTimeout, err)\n\t\t}\n\t}\n\tif drainTimeout != \"\" {\n\t\tif _, err := time.ParseDuration(drainTimeout); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid drainOngoingCallTimeout %q: %w\", drainTimeout, err)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"Catch at runtime init and fail fast: if err := actorsRuntime.Init(ctx); err != nil && strings.Contains(err.Error(), \"failed to parse default actor idle timeout\") { log.Fatal(\"fix actorIdleTimeout in /dapr/config; use Go duration syntax like 1h\") }. The value cannot be corrected at runtime.","preventionTips":["Run time.ParseDuration on every timeout string at config load time.","Derive the JSON string from time.Duration.String() instead of hand-writing it.","Unit-test the /dapr/config payload and parse each duration field."],"tags":["go","dapr","actors","configuration","duration-parsing","startup"],"backgroundTag":null,"analyzedSha":"74ad41702745709bb15fe2114ff693b8c59bc3cc","analyzedAt":"2026-08-16T04:22:26.543Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}