{"record":{"id":"70cada3fa97829c5","repo":"googleapis/mcp-toolbox","slug":"invalid-value-for-delay-w","errorCode":null,"errorMessage":"invalid value for delay: %w","messagePattern":"invalid value for delay: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation.go","lineNumber":131,"sourceCode":"func (cfg Config) ToolConfigType() string {\n\treturn resourceType\n}\n\n// Initialize initializes the tool from the configuration.\nfunc (cfg Config) Initialize(context.Context) (tools.Tool, error) {\n\n\tif cfg.Description == \"\" {\n\t\tcfg.Description = \"This will poll on operations API until the operation is done. For checking operation status we need projectId, locationID and operationId. Once instance is created give follow up steps on how to use the variables to bring data plane MCP server up in local and remote setup.\"\n\t}\n\n\tvar delay time.Duration\n\tif cfg.Delay == \"\" {\n\t\tdelay = 3 * time.Second\n\t} else {\n\t\tvar err error\n\t\tdelay, err = time.ParseDuration(cfg.Delay)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for delay: %w\", err)\n\t\t}\n\t}\n\n\tvar maxDelay time.Duration\n\tif cfg.MaxDelay == \"\" {\n\t\tmaxDelay = 4 * time.Minute\n\t} else {\n\t\tvar err error\n\t\tmaxDelay, err = time.ParseDuration(cfg.MaxDelay)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value for maxDelay: %w\", err)\n\t\t}\n\t}\n\n\tmultiplier := cfg.Multiplier\n\tif multiplier == 0 {\n\t\tmultiplier = 2.0\n\t}","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation.go#L113-L149","documentation":"During Initialize, the alloydb-wait-for-operation tool parses its optional 'delay' field with time.ParseDuration to set the polling interval (default 3s). If the configured string is not a valid Go duration (e.g. '3' or 'three-seconds'), ParseDuration fails and this wrapped error is returned at config load time. The delay must be a Go duration string like '500ms', '2s', or '1m'.","triggerScenarios":"Configuring delay: '3' (missing unit), delay: 'seconds', delay: '5sec', or any string not accepted by time.ParseDuration in the tool's yaml config.","commonSituations":"Users assuming plain numbers mean seconds; typos like '30sec' or '1min30s' (space-free compound with unsupported units); copy-pasted values from non-Go tools.","solutions":["Use a valid Go duration string, e.g. delay: '5s'","Always include a unit suffix (ms, s, m, h) on the numeric value","Remove the delay field entirely to fall back to the 3s default"],"exampleFix":"// before\ndelay: 3\n// after\ndelay: 3s","handlingStrategy":"validation","validationCode":"if _, err := time.ParseDuration(cfg.Delay); err != nil {\n    return fmt.Errorf(\"invalid delay %q: use Go duration like 500ms or 3s\", cfg.Delay)\n}","typeGuard":"func isValidDuration(s string) bool {\n    _, err := time.ParseDuration(s)\n    return s == \"\" || err == nil\n}","tryCatchPattern":"tool, err := alloydbwaitforoperation.Initialize(cfg)\nif err != nil && strings.Contains(err.Error(), \"invalid value for delay\") {\n    return fmt.Errorf(\"check 'delay' in tools.yaml: %w\", err)\n}","preventionTips":["Always include a unit suffix in duration values (ms, s, m, h)","Never use bare numbers for delays in yaml","Validate the config locally before deploying","Omit delay to use the 3s default"],"tags":["alloydb","configuration","duration-parsing","yaml"],"backgroundTag":"invalid-duration-format","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}