{"record":{"id":"07859e39c8d5e868","repo":"oven-sh/bun","slug":"could-not-parse-parameters-for-function-name","errorCode":null,"errorMessage":"Could not parse parameters for function ${name}:\n${contents.slice(0, contents.indexOf(\"\\n\"))}","messagePattern":"Could not parse parameters for function (.+?):\n(.+?)","errorType":"exception","errorClass":"SyntaxError","httpStatus":null,"severity":"error","filePath":"src/codegen/bundle-functions.ts","lineNumber":235,"sourceCode":"          }\n        }\n\n        if (depth > 0) {\n          throw new SyntaxError(\n            `Function ${name} has an unclosed generic type. Missing ${depth} closing angle bracket(s).`,\n          );\n        }\n        remaining = remaining.slice(cursor).trimStart();\n      }\n\n      // parse function parameters\n      assert(\n        remaining.startsWith(\"(\"),\n        new SyntaxError(`Function ${name} is missing parameter list start. Found:\\n\\n\\t${remaining.slice(0, 100)}`),\n      );\n      const paramMatch = remaining.match(/^\\(([^)]*)\\)(?:\\s*:\\s*([^{\\n]+))?\\s*{?/);\n      if (!paramMatch)\n        throw new SyntaxError(\n          `Could not parse parameters for function ${name}:\\n` + contents.slice(0, contents.indexOf(\"\\n\")),\n        );\n      const paramString = paramMatch[1];\n      const params =\n        paramString.trim().length === 0 ? [] : paramString.split(\",\").map(x => x.replace(/:.+$/, \"\").trim());\n      if (params[0] === \"this\") {\n        params.shift();\n      }\n\n      const { result, rest } = sliceSourceCode(remaining.slice(paramMatch[0].length - 1), true, x =>\n        globalThis.requireTransformer(x, SRC_DIR + \"/\" + basename),\n      );\n\n      const source = result.trim().slice(2, -1);\n      const constEnumsUsedInFunction: string[] = [];\n      if (topLevelEnums.length) {\n        // If the function references a top-level const enum let's add the code\n        // to the top-level scope of the function so that the transpiler will","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/codegen/bundle-functions.ts#L217-L253","documentation":"Error \"Could not parse parameters for function ${name}:\n${contents.slice(0, contents.indexOf(\"\\n\"))}\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at src/codegen/bundle-functions.ts:235 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}