flarum/framework · error
error
Error message
error
What it means
ExportRegistry.get() throws this Error when a requested module (namespace:id) cannot be found in the registry or loaded chunks while the extension is enabled and the site is running in debug mode (flarum.debug). In debug mode the registry treats a missing module as a hard error so extension authors notice broken imports immediately; in production it only logs a console.warn. The generic 'error' string is the pre-built error message variable assembled by the caller.
Solutions
- Check the exact namespace:id string against the source extension's registered exports for the flarum version you run.
- Ensure the chunk containing the module is actually loaded (verify the extension's js dist is built and the chunk import is triggered before get()).
- Update or downgrade the extension so its expected module ids match your flarum/core version.
- If the warning is acceptable in production only, disable debug mode — but fix the root cause in development.
- Rebuild the extension's JS assets (npm run build) if dist files are stale.
Example fix
// before
const Post = app.reg.getModule('flarum/forum', 'components/PostStream'); // renamed id
// after
const Post = app.reg.getModule('flarum/forum', 'components/PostStream'); // verify id via app.reg / module docs for your core version Defensive patterns
Strategy: validation
Validate before calling
const id = 'components/PostStream';
const ns = 'flarum/forum';
if (!app.reg.moduleExists?.(ns, id) && !app.reg.getChunk?.(ns)) {
console.warn(`Skipping missing module ${ns}:${id}`);
} else {
const mod = app.reg.getModule(ns, id);
} Type guard
function hasModule(reg, namespace, id) {
return typeof reg?.getModule === 'function' && reg.getModule(namespace, id) != null;
} Try / catch
try {
const mod = app.reg.getModule(ns, id);
} catch (e) {
console.error(`Module ${ns}:${id} not found; feature disabled`, e);
return null;
} Prevention
- Pin extension versions compatible with your flarum/core release.
- Check registry/module ids against upstream source before extending them.
- Keep frontend dist assets built and deployed with each release.
- Enable debug mode in dev environments to catch missing modules early.
- Guard third-party module lookups before consuming the result.
When it happens
Trigger: Calling app.reg.getModule / registry.get(namespace, id) for an id that is neither registered nor present in any loaded chunk (this.chunkModules has no `${namespace}:${id}`) while extensionEnabled is true and flarum.debug is true.
Common situations: An extension registers/imports a module id that was renamed or removed in a newer flarum/core; a frontend chunk failed to load so its modules were never exported; a typo in the namespace or id; an extension extends another extension's module that is lazily chunked and not yet loaded.
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
- [Export Registry] No chunk by the ID
- ...args
- You cannot disable the default language pack!
- ValidationException (messages from password validator)
- core.admin.appearance.custom_styles_cannot_use_less_features
AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15).
Data as JSON: /api/errors/79e381d7c95b1ff1.
Report an issue: GitHub.
Appendix: source
Thrown at framework/core/js/src/common/ExportRegistry.ts:131
this.onLoads.set(namespace, this.onLoads.get(namespace) || new Map());
this.onLoads.get(namespace)?.set(id, this.onLoads.get(namespace)?.get(id) || []);
this.onLoads.get(namespace)?.get(id)?.push(handler);
}
}
get(namespace: string, id: string): any {
const module = this.moduleExports.get(namespace)?.get(id);
const extensionEnabled = namespace in flarum.extensions || namespace === 'core';
const error = `No module found for ${namespace}:${id}`;
// Check if the module is registered in a chunk (will be loaded lazily)
const isInChunk = this.chunkModules.has(`${namespace}:${id}`);
// @ts-ignore
if (!module && extensionEnabled && !isInChunk && flarum.debug) {
throw new Error(error);
} else if (!module && extensionEnabled && !isInChunk) {
console.warn(error);
}
return module;
}
public checkModule(namespace: string, id: string): any | false {
const exists = (this.moduleExports.has(namespace) && this.moduleExports.get(namespace)?.has(id)) || false;
return exists ? this.get(namespace, id) : false;
}
addChunkModule(chunkId: number | string, moduleId: number | string, namespace: string, urlPath: string): void {
if (!this.chunks.has(chunkId.toString())) {
this.chunks.set(chunkId.toString(), {
namespace,
urlPath,
modules: [urlPath],
});View on GitHub (pinned to 4b939f6853)