remix-run/remix · error · Error
invalid bypass pattern ${JSON.stringify(pattern)}: "{$}" is
Error message
invalid bypass pattern ${JSON.stringify(pattern)}: "{$}" is not supported in cop-middleware What it means
cop-middleware deliberately does not support the '{$}' catch-all dollar wildcard that other Remix routing layers may recognize. parseBypassSegment throws when a wildcard's name is exactly '$'. Bypass patterns in cop-middleware use '{name...}' tail wildcards instead.
Source
Thrown at packages/cop-middleware/src/lib/cop.ts:288
if (segment === '') {
throw new Error(
`invalid bypass pattern ${JSON.stringify(pattern)}: empty path segments are not allowed`,
)
}
if (!segment.startsWith('{') || !segment.endsWith('}')) {
return { type: 'static', value: segment }
}
let wildcardName = segment.slice(1, segment.length - 1)
if (wildcardName === '') {
throw new Error(
`invalid bypass pattern ${JSON.stringify(pattern)}: empty wildcards are not allowed`,
)
}
if (wildcardName === '$') {
throw new Error(
`invalid bypass pattern ${JSON.stringify(pattern)}: "{$}" is not supported in cop-middleware`,
)
}
if (wildcardName.endsWith('...')) {
if (!isLastSegment) {
throw new Error(
`invalid bypass pattern ${JSON.stringify(pattern)}: tail wildcards must be last`,
)
}
if (wildcardName.length === 3) {
throw new Error(
`invalid bypass pattern ${JSON.stringify(pattern)}: tail wildcards require a name`,
)
}
return { type: 'rest' }View on GitHub (pinned to 9696913134)
Solutions
- Replace '{$}' with a named tail wildcard: '/legacy/{rest...}'
- Review cop-middleware docs for supported wildcard syntax ({name} and {name...})
Example fix
// before
cop.addInsecureBypassPattern('/legacy/{$}')
// after
cop.addInsecureBypassPattern('/legacy/{rest...}') Defensive patterns
Strategy: validation
Validate before calling
if (pattern.includes('{$}')) throw new Error('use {name...} instead of {$}') Type guard
const usesSupportedWildcards = (p: string) => !p.includes('{$}') Prevention
- Do not copy route-config syntax into bypass patterns
- Keep a cheat sheet of cop-middleware wildcard syntax in the config module
When it happens
Trigger: addInsecureBypassPattern('/legacy/{$}') or any pattern with a '{$}' segment, often copied from Remix route config or other route-matching syntax.
Common situations: Porting route patterns from Remix's pathless/catch-all route syntax into cop-middleware bypass config; assuming shared wildcard syntax across routing libraries.
Related errors
- invalid bypass pattern ${JSON.stringify(pattern)}: empty wil
- invalid bypass pattern ${JSON.stringify(pattern)}: tail wild
- invalid bypass pattern ${JSON.stringify(pattern)}: tail wild
- invalid bypass pattern ${JSON.stringify(pattern)}: path must
- invalid bypass pattern ${JSON.stringify(pattern)}: query str
AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27).
Data as JSON: /api/errors/0bfec70dbdeb8785.
Report an issue: GitHub.