{"record":{"id":"908c8f2db94dad8b","repo":"oven-sh/bun","slug":"function-name-has-an-unclosed-generic-type-mis","errorCode":null,"errorMessage":"Function ${name} has an unclosed generic type. Missing ${depth} closing angle bracket(s).","messagePattern":"Function (.+?) has an unclosed generic type\\. Missing (.+?) closing angle bracket\\(s\\)\\.","errorType":"exception","errorClass":"SyntaxError","httpStatus":null,"severity":"error","filePath":"src/codegen/bundle-functions.ts","lineNumber":221,"sourceCode":"      var remaining = contents.slice(nameMatch[0].length);\n\n      // remove type parameters\n      if (remaining.startsWith(\"<\")) {\n        var cursor = 1; // skip peeked '<'\n        var depth = 1; // already entered first bracket pair\n        for (; depth > 0 && cursor < remaining.length; cursor++) {\n          switch (remaining[cursor]) {\n            case \"<\":\n              depth++;\n              break;\n            case \">\":\n              depth--;\n              break;\n          }\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 =","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/codegen/bundle-functions.ts#L203-L239","documentation":"Error \"Function ${name} has an unclosed generic type. Missing ${depth} closing angle bracket(s).\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at src/codegen/bundle-functions.ts:221 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"}