oven-sh/bun · error · SyntaxError

Could not parse parameters for function ${name}: ${contents.

Error message

Could not parse parameters for function ${name}:
${contents.slice(0, contents.indexOf("\n"))}

What it means

Error "Could not parse parameters for function ${name}: ${contents.slice(0, contents.indexOf("\n"))}" thrown in oven-sh/bun.

Source

Thrown at src/codegen/bundle-functions.ts:235

          }
        }

        if (depth > 0) {
          throw new SyntaxError(
            `Function ${name} has an unclosed generic type. Missing ${depth} closing angle bracket(s).`,
          );
        }
        remaining = remaining.slice(cursor).trimStart();
      }

      // parse function parameters
      assert(
        remaining.startsWith("("),
        new SyntaxError(`Function ${name} is missing parameter list start. Found:\n\n\t${remaining.slice(0, 100)}`),
      );
      const paramMatch = remaining.match(/^\(([^)]*)\)(?:\s*:\s*([^{\n]+))?\s*{?/);
      if (!paramMatch)
        throw new SyntaxError(
          `Could not parse parameters for function ${name}:\n` + contents.slice(0, contents.indexOf("\n")),
        );
      const paramString = paramMatch[1];
      const params =
        paramString.trim().length === 0 ? [] : paramString.split(",").map(x => x.replace(/:.+$/, "").trim());
      if (params[0] === "this") {
        params.shift();
      }

      const { result, rest } = sliceSourceCode(remaining.slice(paramMatch[0].length - 1), true, x =>
        globalThis.requireTransformer(x, SRC_DIR + "/" + basename),
      );

      const source = result.trim().slice(2, -1);
      const constEnumsUsedInFunction: string[] = [];
      if (topLevelEnums.length) {
        // If the function references a top-level const enum let's add the code
        // to the top-level scope of the function so that the transpiler will

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at src/codegen/bundle-functions.ts:235 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/07859e39c8d5e868. Report an issue: GitHub.