oven-sh/bun · error · Error

String did not end

Error message

String did not end

What it means

Thrown by getEndOfBasicString in the builtin parser: it scanned a quoted string literal from offset 0 to the end of input without finding the matching unescaped closing quote (backslash-escaped characters are skipped), meaning the literal is unterminated in the builtin source being sliced.

Solutions

  1. Fix the unterminated string literal in the builtin JS source
  2. If the quote character is legitimately part of the code (e.g. inside a char literal heuristic), adjust the caller to slice from after the opening delimiter correctly
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/codegen/builtin-parser.ts:199 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/a1f1ac6415f43914. Report an issue: GitHub.

Appendix: source

Thrown at src/codegen/builtin-parser.ts:199

    } else {
      throw new Error("TODO");
    }
  }

  return { result, rest: contents };
}

function getEndOfBasicString(str: string, quote: "'" | '"') {
  let i = 0;
  while (i < str.length) {
    if (str[i] === "\\") {
      i++;
    } else if (str[i] === quote) {
      return i;
    }
    i++;
  }
  throw new Error("String did not end");
}

View on GitHub (pinned to 8c5296ac45)