{"record":{"id":"af6f5860226ed20f","repo":"chenhg5/cc-connect","slug":"timeout-mins-must-be-an-integer","errorCode":null,"errorMessage":"timeout_mins must be an integer","messagePattern":"timeout_mins must be an integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/cron.go","lineNumber":581,"sourceCode":"// *bool / *int fields and returns the misleading error\n// \"unknown or invalid field: <field>\".\n//\n// `silent` was previously missing from the bool case here even though it's\n// documented as a bool in printCronEditUsage, so `cc-connect cron edit <id>\n// silent true` failed with \"unknown or invalid field: silent\" — see the\n// regression test in cron_edit_test.go.\nfunc parseCronEditValue(field, valueStr string) (any, error) {\n\tswitch field {\n\tcase \"enabled\", \"mute\", \"silent\":\n\t\tv, err := strconv.ParseBool(valueStr)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"%s must be true or false\", field)\n\t\t}\n\t\treturn v, nil\n\tcase \"timeout_mins\":\n\t\tv, err := strconv.Atoi(valueStr)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"timeout_mins must be an integer\")\n\t\t}\n\t\treturn v, nil\n\tdefault:\n\t\t// String fields: project, session_key, cron_expr, prompt, exec,\n\t\t// work_dir, description, session_mode, mode\n\t\treturn valueStr, nil\n\t}\n}\n\nfunc apiPost(sockPath, path string, payload []byte) (*http.Response, error) {\n\tclient := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDialContext: func(_ context.Context, _, _ string) (net.Conn, error) {\n\t\t\t\treturn net.Dial(\"unix\", sockPath)\n\t\t\t},\n\t\t},\n\t}\n\treturn client.Post(\"http://unix\"+path, \"application/json\", bytes.NewReader(payload))","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/cron.go#L563-L599","documentation":"parseCronEditValue validates values passed to `cc-connect cron edit`. For the timeout_mins field it calls strconv.Atoi and throws this error when the string is not a valid integer. It exists so that a session timeout given in minutes is always a whole number of minutes, catching typos like 'abc', '10m', '3.5', or empty strings before they reach cron scheduling.","triggerScenarios":"Running `cc-connect cron edit <id> timeout_mins 10m` (unit suffix not allowed), `... timeout_mins 3.5` (decimals rejected), `... timeout_mins \"\"` (empty), or any non-numeric value such as `abc`.","commonSituations":"Users type durations the way they write them elsewhere ('30m', '1h'), paste values with quotes or whitespace from config files, or leave the value empty in scripts.","solutions":["Pass a plain integer number of minutes, e.g. timeout_mins 30","Strip unit suffixes and quotes from the value before invoking the command","Compute the value in minutes in the calling script (e.g. $((hours*60)))"],"exampleFix":"// before\ncc-connect cron edit c1 timeout_mins 30m\n// after\ncc-connect cron edit c1 timeout_mins 30","handlingStrategy":"validation","validationCode":"func validTimeoutMins(v string) bool { _, err := strconv.Atoi(strings.TrimSpace(v)); return err == nil }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass whole-number minutes without unit suffixes","Validate the value with strconv.Atoi in scripts before invoking cron edit","Quote values but never add 'm'/'h' suffixes"],"tags":["cli","cron","validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}