{"record":{"id":"5cf2747052f21346","repo":"sveltejs/kit","slug":"sveltejs-adapter-bun-requires-bun-1-4-or-newer-b","errorCode":null,"errorMessage":"@sveltejs/adapter-bun requires Bun 1.4 or newer, but this is Bun ${Bun.version}","messagePattern":"@sveltejs/adapter-bun requires Bun 1\\.4 or newer, but this is Bun (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/adapter-bun/src/index.js","lineNumber":12,"sourceCode":"/** @import { Serve } from 'bun' */\nimport fs from 'node:fs';\nimport process from 'node:process';\nimport server_options from 'SERVER_OPTIONS';\nimport { routes } from 'ROUTES';\nimport { handler } from './handler.js';\nimport { boolean_env, bytes_env, env, number_env } from './env.js';\n\n// nothing enforces `engines.bun` at install time, and the build may have run on a newer Bun.\n// order() rather than satisfies(): a range would reject canary builds such as 1.5.0-canary.1\nif (Bun.semver.order(Bun.version, '1.4.0') < 0) {\n\tthrow new Error(\n\t\t`@sveltejs/adapter-bun requires Bun 1.4 or newer, but this is Bun ${Bun.version}`\n\t);\n}\n\nconst options = /** @type {Serve.Options<undefined>} */ ({ ...server_options });\n\nconst unix = env('SOCKET_PATH', options.unix);\n\nif (unix) {\n\toptions.unix = unix;\n\tdelete options.hostname;\n\tdelete options.port;\n\tdelete options.reusePort;\n\tdelete options.ipv6Only;\n\n\t// an unclean shutdown leaves the socket file behind and the next listen would\n\t// fail with EADDRINUSE; the zero-size check (same heuristic as adapter-node)\n\t// avoids deleting a regular file that happens to sit at this path","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/adapter-bun/src/index.js#L1-L30","documentation":"adapter-bun uses Bun APIs (Bun.semver, Serve options) available only in Bun 1.4+. Because npm's engines.bun is not enforced at install time and builds may run on a different Bun than runtime, the adapter checks at startup with Bun.semver.order and throws if the running version is older than 1.4.0.","triggerScenarios":"Starting the built server on a runtime with Bun < 1.4.0 (e.g. 1.2.x/1.3.x or older canary), typically after a dependency update that raised the minimum supported Bun.","commonSituations":"Stale Bun on CI/production servers while local dev uses a newer version; Docker images pinning old oven/bun tags; forgetting to `bun upgrade` after adapter update.","solutions":["Upgrade Bun to 1.4 or newer: `bun upgrade` (or update your Docker base image to oven/bun:latest / a 1.4+ tag).","Pin `engines.bun` in package.json and ensure CI and prod images use the same version.","If you cannot upgrade, downgrade @sveltejs/adapter-bun to a version supporting your Bun release."],"exampleFix":"// Dockerfile before\nFROM oven/bun:1.2\n// after\nFROM oven/bun:1.4","handlingStrategy":"validation","validationCode":"if (typeof Bun !== 'undefined' && Bun.semver.order(Bun.version, '1.4.0') < 0) {\n  throw new Error(`Bun >= 1.4 required, found ${Bun.version}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await import('./server.js');\n} catch (err) {\n  if (/requires Bun 1.4 or newer/.test(err.message)) {\n    console.error('Run `bun upgrade` or update the oven/bun Docker image');\n  }\n  throw err;\n}","preventionTips":["Pin oven/bun:1.4+ in Docker images and CI.","Add a version check step to your deploy pipeline (`bun --version`).","Keep local, CI, and production Bun versions aligned."],"tags":["version-compatibility","runtime","adapter-bun","bun"],"backgroundTag":"unsupported-runtime-version","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}