{"record":{"id":"b83ac3e37d4fd08e","repo":"parcel-bundler/parcel","slug":"bundle-is-not-inline-and-unable-to-retrieve-conten","errorCode":null,"errorMessage":"Bundle is not inline and unable to retrieve contents","messagePattern":"Bundle is not inline and unable to retrieve contents","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/PackagerRunner.js","lineNumber":481,"sourceCode":"        bundleConfig: bundleConfigs.get(name)?.result,\n        bundle,\n        bundleGraph: new BundleGraph<NamedBundleType>(\n          bundleGraph,\n          NamedBundle.get.bind(NamedBundle),\n          this.options,\n        ),\n        getSourceMapReference: map => {\n          return this.getSourceMapReference(bundle, map);\n        },\n        options: this.pluginOptions,\n        logger: new PluginLogger({origin: name}),\n        tracer: new PluginTracer({origin: name, category: 'package'}),\n        getInlineBundleContents: async (\n          bundle: BundleType,\n          bundleGraph: BundleGraphType<NamedBundleType>,\n        ) => {\n          if (bundle.bundleBehavior !== 'inline') {\n            throw new Error(\n              'Bundle is not inline and unable to retrieve contents',\n            );\n          }\n\n          let contents = await this.getInlineBundleContents(\n            bundleToInternalBundle(bundle),\n            // $FlowFixMe\n            bundleGraphToInternalBundleGraph(bundleGraph),\n            configs,\n            bundleConfigs,\n          );\n          return {contents};\n        },\n      });\n      if (Array.isArray(res)) {\n        return res;\n      }\n      return [res];","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/PackagerRunner.js#L463-L499","documentation":"`getInlineBundleContents` is a plugin-facing API on PackagerRunner that returns the bytes of a bundle whose `bundleBehavior` is `'inline'`. Inline bundles are embedded inside their parent (e.g. for service workers or data URLs). Calling this API on a regular bundle is a contract violation: the bundle was never materialized as standalone content, so there is nothing to return.","triggerScenarios":"A custom packager/optimizer plugin calls `getInlineBundleContents(bundle, bundleGraph)` for a bundle whose `bundle.bundleBehavior !== 'inline'`.","commonSituations":"Writing a packager that iterates all child bundles without filtering by behavior; assuming every bundle in a group is inline.","solutions":["Guard the call: only invoke when `bundle.bundleBehavior === 'inline'`.","Use the regular bundle-reading path (e.g. `getBundleResult`) for non-inline bundles.","If you expect the bundle to be inline, check that the entry asset/target sets `bundleBehavior: 'inline'`."],"exampleFix":"// before\nconst {contents} = await getInlineBundleContents(bundle, bundleGraph);\n\n// after\nif (bundle.bundleBehavior !== 'inline') return null;\nconst {contents} = await getInlineBundleContents(bundle, bundleGraph);","handlingStrategy":"validation","validationCode":"// Verify bundle behavior before requesting inline contents.\nif (bundle.bundleBehavior !== 'inline') {\n  return null; // or use the regular bundle-read path\n}\nconst {contents} = await getInlineBundleContents(bundle, bundleGraph);","typeGuard":"function isInlineBundle(b: {bundleBehavior?: string}): boolean {\n  return b.bundleBehavior === 'inline';\n}","tryCatchPattern":null,"preventionTips":["Filter child bundles by bundleBehavior in custom packagers.","Document which bundle shapes your plugin handles.","Add unit tests covering both inline and non-inline bundles."],"tags":["bundler","plugin","inline-bundle"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}