{"record":{"id":"0bfec70dbdeb8785","repo":"remix-run/remix","slug":"invalid-bypass-pattern-json-stringify-pattern-0bfec7","errorCode":null,"errorMessage":"invalid bypass pattern ${JSON.stringify(pattern)}: \"{$}\" is not supported in cop-middleware","messagePattern":"invalid bypass pattern (.+?): \"(.+?)\" is not supported in cop-middleware","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cop-middleware/src/lib/cop.ts","lineNumber":288,"sourceCode":"  if (segment === '') {\n    throw new Error(\n      `invalid bypass pattern ${JSON.stringify(pattern)}: empty path segments are not allowed`,\n    )\n  }\n\n  if (!segment.startsWith('{') || !segment.endsWith('}')) {\n    return { type: 'static', value: segment }\n  }\n\n  let wildcardName = segment.slice(1, segment.length - 1)\n  if (wildcardName === '') {\n    throw new Error(\n      `invalid bypass pattern ${JSON.stringify(pattern)}: empty wildcards are not allowed`,\n    )\n  }\n\n  if (wildcardName === '$') {\n    throw new Error(\n      `invalid bypass pattern ${JSON.stringify(pattern)}: \"{$}\" is not supported in cop-middleware`,\n    )\n  }\n\n  if (wildcardName.endsWith('...')) {\n    if (!isLastSegment) {\n      throw new Error(\n        `invalid bypass pattern ${JSON.stringify(pattern)}: tail wildcards must be last`,\n      )\n    }\n\n    if (wildcardName.length === 3) {\n      throw new Error(\n        `invalid bypass pattern ${JSON.stringify(pattern)}: tail wildcards require a name`,\n      )\n    }\n\n    return { type: 'rest' }","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cop-middleware/src/lib/cop.ts#L270-L306","documentation":"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.","triggerScenarios":"addInsecureBypassPattern('/legacy/{$}') or any pattern with a '{$}' segment, often copied from Remix route config or other route-matching syntax.","commonSituations":"Porting route patterns from Remix's pathless/catch-all route syntax into cop-middleware bypass config; assuming shared wildcard syntax across routing libraries.","solutions":["Replace '{$}' with a named tail wildcard: '/legacy/{rest...}'","Review cop-middleware docs for supported wildcard syntax ({name} and {name...})"],"exampleFix":"// before\ncop.addInsecureBypassPattern('/legacy/{$}')\n// after\ncop.addInsecureBypassPattern('/legacy/{rest...}')","handlingStrategy":"validation","validationCode":"if (pattern.includes('{$}')) throw new Error('use {name...} instead of {$}')","typeGuard":"const usesSupportedWildcards = (p: string) => !p.includes('{$}')","tryCatchPattern":null,"preventionTips":["Do not copy route-config syntax into bypass patterns","Keep a cheat sheet of cop-middleware wildcard syntax in the config module"],"tags":["cop-middleware","bypass-pattern","wildcard","syntax"],"backgroundTag":"invalid-path-pattern","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}