kataras/iris · warning
parameter is not a valid weekday
Error message
parameter is not a valid weekday
What it means
ErrParamNotWeekday is fired when a path parameter evaluated by the 'weekday' macro is not one of Go's long day names (Sunday, Monday, ..., Saturday), which map to time.Weekday values. The value must match a day name exactly (case-sensitive).
Source
Thrown at macro/macros.go:473
}
return paramValue, true
})
simpleDateLayout = "2006/01/02"
// Date type.
Date = NewMacro("date", "", time.Time{}, false, true, func(paramValue string) (any, bool) {
tt, err := time.Parse(simpleDateLayout, paramValue)
if err != nil {
return fmt.Errorf("%s: %w", paramValue, err), false
}
return tt, true
})
// ErrParamNotWeekday is fired when the parameter value is not a form of a time.Weekday.
ErrParamNotWeekday = errors.New("parameter is not a valid weekday")
longDayNames = map[string]time.Weekday{
"Sunday": time.Sunday,
"Monday": time.Monday,
"Tuesday": time.Tuesday,
"Wednesday": time.Wednesday,
"Thursday": time.Thursday,
"Friday": time.Friday,
"Saturday": time.Saturday,
// lowercase.
"sunday": time.Sunday,
"monday": time.Monday,
"tuesday": time.Tuesday,
"wednesday": time.Wednesday,
"thursday": time.Thursday,
"friday": time.Friday,
"saturday": time.Saturday,
}
View on GitHub (pinned to 7bedaf55a0)
Solutions
- Send the exact capitalized long day name, e.g. /schedule/Monday.
- Handle normalization in a custom macro (e.g. title-case input before lookup).
- Use {day:string} and parse/validate manually if you need flexible input formats.
Example fix
// before
// GET /schedule/monday -> error
// after
// GET /schedule/Monday
app.Get("/schedule/{day:weekday}", h) Defensive patterns
Strategy: validation
Validate before calling
const LONG_DAYS = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
if (!LONG_DAYS.includes(day)) day = LONG_DAYS[new Date(`${day} 1 2020`).getDay()] ?? 'Monday'; Type guard
const LONG_DAYS = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] as const;
function isWeekdayName(v: string): v is typeof LONG_DAYS[number] {
return (LONG_DAYS as readonly string[]).includes(v);
} Prevention
- Always send exact capitalized long day names.
- Normalize case client-side before building the URL.
- Reject abbreviated day names in forms.
When it happens
Trigger: Route like app.Get('/schedule/{day:weekday}', h) with requests such as '/schedule/monday' (lowercase), '/schedule/Mon', or '/schedule/1' — only exact long names pass.
Common situations: Clients send abbreviated day names or non-English day names; case-sensitivity surprises (monday vs Monday); dates passed instead of day names.
Related errors
- errors joined from param parser: strings.Join(p.errors, "\n"
- parameter is not alphabetical
- parameter is not a file
- empty form
- no trailing path parameter found
AI-assisted analysis of kataras/iris@7bedaf55a0 (2026-08-30).
Data as JSON: /api/errors/094221006e8b783a.
Report an issue: GitHub.