{"record":{"id":"33698899dcc0afa7","repo":"cypress-io/cypress","slug":"invalid-grep-burn-value-grepburn","errorCode":null,"errorMessage":"Invalid grep burn value: ${grepBurn}","messagePattern":"Invalid grep burn value: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"npm/grep/src/register.ts","lineNumber":63,"sourceCode":"\n  if (!grep && !grepTags && !burnSpecified && !grepUntagged) {\n    debugInstance('Nothing to grep, version %s', version)\n\n    return\n  }\n\n  const grepBurn: number =\n    Cypress.expose('grepBurn') ||\n    Cypress.expose('grep-burn') ||\n    Cypress.expose('burn') ||\n    1\n\n  const omitFiltered: boolean =\n    Cypress.expose('grepOmitFiltered') || Cypress.expose('grep-omit-filtered')\n\n  debugInstance('grep %o', { grep, grepTags, grepBurn, omitFiltered, version })\n  if (!Cypress._.isInteger(grepBurn) || grepBurn < 1) {\n    throw new Error(`Invalid grep burn value: ${grepBurn}`)\n  }\n\n  const parsedGrep = parseGrep(grep, grepTags)\n\n  debugInstance('parsed grep %o', parsedGrep)\n\n  if (it.name === 'itGrep') {\n    debugInstance('already registered @cypress/grep')\n\n    return\n  }\n\n  // @ts-expect-error - it is missing only, skip, and retries which are overridden below\n  it = function itGrep (name: string, options: any, callback?: Func | AsyncFunc): Mocha.Test | void[] {\n    if (typeof options === 'function') {\n      callback = options\n      options = {}\n    }","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/cypress-io/cypress/blob/0d85fdc91230885bca0a91df278312800a48b727/npm/grep/src/register.ts#L45-L81","documentation":"Thrown by the @cypress/grep register logic after resolving the `burn` value (number of times to repeat each filtered test). The guard requires grepBurn to be a positive integer (Cypress._.isInteger AND >= 1); default is 1. A non-integer (float, NaN, string) or a value below 1 is rejected because the burn loop cannot meaningfully repeat a fractional or zero/negative number of times.","triggerScenarios":"Setting the grep burn via env/expose to a non-integer or <1 value, e.g. `CYPRESS_GREP_BURN=2.5`, `--env grepBurn=0`, `--env burn=-1`, or `--env grepBurn=abc`. The value is read through Cypress.expose('grepBurn') | Cypress.expose('grep-burn') | Cypress.expose('burn'), defaulting to 1.","commonSituations":"Passing a float by accident (2.5), passing 0 expecting 'no burn', passing a string because the env var was not coerced, or a CI script interpolating an empty/undefined variable that becomes NaN.","solutions":["Set burn to a positive integer: `--env grepBurn=3` or `CYPRESS_GREP_BURN=3`.","If you intended 'no repetition', omit the burn env entirely (it defaults to 1).","Ensure env vars are coerced to numbers before passing; avoid strings like `--env grepBurn=\"3\"` if your shell/runner mangles them.","Check for accidental `grep-burn` / `burn` aliases overriding a correct `grepBurn`."],"exampleFix":"// before\nCYPRESS_GREP_BURN=2.5 cypress run --env grep=@smoke\n// after\nCYPRESS_GREP_BURN=3 cypress run --env grep=@smoke","handlingStrategy":"validation","validationCode":"function resolveBurn(raw: unknown): number {\n  const n = Number(raw)\n  if (!Number.isInteger(n) || n < 1) return 1 // sane default instead of throwing\n  return n\n}","typeGuard":"const isPositiveInt = (v: unknown): v is number => typeof v === 'number' && Number.isInteger(v) && v >= 1","tryCatchPattern":"try { /* register grep */ } catch (e) { if (/Invalid grep burn value/.test(e.message)) { Cypress.expose('grepBurn', 1); /* retry registration */ } else throw e }","preventionTips":["Coerce env-provided numeric config with Number() and validate with Number.isInteger.","Default burn to 1 when the env value is absent or invalid rather than letting it throw.","Document grepBurn as a positive integer in your project's CI config."],"tags":["grep","validation","env","configuration"],"backgroundTag":null,"analyzedSha":"0d85fdc91230885bca0a91df278312800a48b727","analyzedAt":"2026-08-12T16:24:28.056Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}