flarum/framework · warning

[Export Registry] No chunk by the ID

Error message

[Export Registry] No chunk by the ID ${chunkId} found.

What it means

ExportRegistry.getChunk() warns (console.warn, not a throw) when a requested chunk id does not exist in this.chunks, and returns null so callers like chunk() can react. Flarum's export registry splits frontend exports into lazily loadable chunks; this warning signals you asked for a chunk that was never registered or already-consumed.

Solutions

  1. Verify the chunk id exists by checking what the extension/core registers (build output or registry keys).
  2. Rebuild/redeploy the extension's frontend dist so chunks are registered.
  3. Clear frontend asset cache / hard reload to drop stale chunk references.
  4. Ensure you await/trigger the chunk load before consuming its exports.
  5. Match id type usage: getChunk stringifies ids internally, so confirm the same string used at registration.

Example fix

// before
const chunk = app.reg.getChunk(7); // numeric guess
// after
const chunk = app.reg.getChunk('flarum/core/forum'); // registered chunk id
Defensive patterns

Strategy: fallback

Validate before calling

const chunkId = 'flarum/core/forum';
if (typeof app.reg.getChunk === 'function' && app.reg.getChunk(chunkId) === null) {
  console.warn(`Chunk ${chunkId} unavailable; skipping dependent feature`);
}

Type guard

function hasChunk(reg, id) {
  return reg?.getChunk?.(id.toString()) != null;
}

Try / catch

const chunk = app.reg.getChunk(chunkId);
if (chunk === null) {
  console.warn(`Chunk ${chunkId} missing; falling back to lazy import`);
  return import('flarum/core/forum').catch(() => null);
}

Prevention

When it happens

Trigger: Calling registry.getChunk(id) / registry.chunk(id) with a chunkId (number or string) that is not a key of the chunks Map — usually because the chunk's JS bundle never registered its exports (failed/missed bundle load) or the id is mistyped.

Common situations: Extension JS dist assets missing or not deployed after an update; stale cached frontend referencing old chunk ids; manually calling chunk() with a numeric id when only string ids are registered; a build that renamed chunk hashes.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15). Data as JSON: /api/errors/679c7937e2f9b353. Report an issue: GitHub.

Appendix: source

Thrown at framework/core/js/src/common/ExportRegistry.ts:164

        namespace,
        urlPath,
        modules: [urlPath],
      });
    } else {
      this.chunks.get(chunkId.toString())?.modules?.push(urlPath);
    }

    this.chunkModules.set(`${namespace}:${urlPath}`, {
      chunkId: chunkId.toString(),
      moduleId: moduleId.toString(),
    });
  }

  getChunk(chunkId: number | string): Chunk | null {
    const chunk = this.chunks.get(chunkId.toString()) ?? null;

    if (!chunk) {
      console.warn(`[Export Registry] No chunk by the ID ${chunkId} found.`);
      return null;
    }

    return chunk;
  }

  async loadChunk(original: Function, url: string, done: (...args: any) => Promise<void>, key: number, chunkId: number | string): Promise<void> {
    // @ts-ignore
    app.alerts.showLoading();

    const chunkUrl = this.chunkUrl(chunkId) || url;

    const load = (): Promise<void> =>
      original(
        chunkUrl,
        (...args: any) => {
          const event: Event | undefined = args[0];

View on GitHub (pinned to 4b939f6853)