{"record":{"id":"6ee065678a2ff352","repo":"robfig/cron","slug":"unrecognized-descriptor-s","errorCode":null,"errorMessage":"unrecognized descriptor: %s","messagePattern":"unrecognized descriptor: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"parser.go","lineNumber":433,"sourceCode":"\t\t\tHour:     all(hours),\n\t\t\tDom:      all(dom),\n\t\t\tMonth:    all(months),\n\t\t\tDow:      all(dow),\n\t\t\tLocation: loc,\n\t\t}, nil\n\n\t}\n\n\tconst every = \"@every \"\n\tif strings.HasPrefix(descriptor, every) {\n\t\tduration, err := time.ParseDuration(descriptor[len(every):])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse duration %s: %s\", descriptor, err)\n\t\t}\n\t\treturn Every(duration), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"unrecognized descriptor: %s\", descriptor)\n}\n","sourceCodeStart":415,"sourceCodeEnd":435,"githubUrl":"https://github.com/robfig/cron/blob/bc59245fe10efaed9d51b56900192527ed733435/parser.go#L415-L435","documentation":"Thrown by parseDescriptor in parser.go when the schedule string starts with '@' but doesn't match any supported descriptor (@yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly, or the '@every <duration>' prefix). Parse routes any '@'-prefixed string here first, so unknown at-directives fall through to this error.","triggerScenarios":"Calling cron.Parse with unsupported or misspelled descriptors: '@every' (missing space), '@ever 5m', '@reboot', '@hourIy' (uppercase I), '@Yearly' (case-sensitive switch), or custom at-syntax like '@interval 10m' that this library doesn't define.","commonSituations":"Migrating from Vixie cron which supports '@reboot'; copying Quartz or other scheduler directives; typos or capitalization differences; building the descriptor dynamically and forgetting the mandatory space in '@every '; users entering free-form schedule text in a UI.","solutions":["Check spelling and case — descriptors are lowercase and exact: @yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly","For interval schedules use the exact prefix '@every ' (with a space) followed by a valid duration, e.g. '@every 5m'","Note '@reboot' is unsupported; register the job explicitly at startup instead","Validate user-supplied schedule strings with cron.Parse before storing them"],"exampleFix":"// before\ncron.Parse(\"@reboot\") // not a supported descriptor\n// after\ncron.Parse(\"@daily\") // or run the job directly in main()","handlingStrategy":"validation","validationCode":"var descriptors = map[string]bool{\"@yearly\":true,\"@annually\":true,\"@monthly\":true,\"@weekly\":true,\"@daily\":true,\"@midnight\":true,\"@hourly\":true}\nfunc knownDescriptor(s string) bool {\n\treturn descriptors[s] || strings.HasPrefix(s, \"@every \")\n}","typeGuard":null,"tryCatchPattern":"sched, err := cron.Parse(spec)\nif err != nil {\n\treturn fmt.Errorf(\"invalid cron spec %q: %w\", spec, err)\n}","preventionTips":["Descriptors are lowercase and case-sensitive; whitelist them in UI/config validation","Include the space in '@every <duration>' when building strings dynamically","Replace unsupported directives like '@reboot' with explicit startup code"],"tags":["cron","descriptor","parser","go"],"backgroundTag":"invalid-enum-value","analyzedSha":"bc59245fe10efaed9d51b56900192527ed733435","analyzedAt":"2026-09-07T00:35:06.760Z","contentChangedAt":"2026-09-07T00:35:06.760Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}