dianping/cat · critical · Error
failed to require "{name}"
Error message
failed to require "{name}" What it means
dropzone.js is built with the (old) component module system: each internal file is registered in require.modules and require(name) looks it up. This throw means a module name was required that was never registered — i.e. the dropzone build/bundle is incomplete or was altered. It is essentially an internal integrity check, not a normal user-facing API error.
Source
Thrown at cat-home/src/main/webapp/assets/js/uncompressed/dropzone.js:14
;(function(){
/**
* Require the module at `name`.
*
* @param {String} name
* @return {Object} exports
* @api public
*/
function require(name) {
var module = require.modules[name];
if (!module) throw new Error('failed to require "' + name + '"');
if (!('exports' in module) && typeof module.definition === 'function') {
module.client = module.component = true;
module.definition.call(this, module.exports = {}, module);
delete module.definition;
}
return module.exports;
}
/**
* Registered modules.
*/
require.modules = {};
/**
* Register module at `name` with callback `definition`.View on GitHub (pinned to e815e74d4c)
Solutions
- Replace the altered/truncated file with the official dropzone.js build from the same version.
- If concatenating assets, include the entire dropzone file unmodified.
- Do not call Dropzone's internal require() from application code — use the public Dropzone API.
Defensive patterns
Strategy: try-catch
Validate before calling
if (typeof window.Dropzone === 'undefined') {
console.error('dropzone.js failed to load intact (internal modules missing). Re-place the file with the official build.');
} Try / catch
try {
new Dropzone(el, { url: '/upload' });
} catch (e) {
if (/failed to require/.test(e.message)) {
logAssetError('dropzone.js build is truncated — replace with official build', e);
} else { throw e; }
} Prevention
- Never hand-edit or partially concatenate dropzone.js; ship the official file.
- Smoke-test uploads after any change to the asset pipeline.
- Pin the dropzone version and verify checksum/file size on deploy.
When it happens
Trigger: Loading a truncated or hand-edited dropzone.js where some require.modules[...] registrations are missing; re-packaging dropzone with a bundler that drops internal module registrations; calling the internal require() directly with a wrong name.
Common situations: Custom/minified rebuilds of dropzone 3.x/4.x that strip the component wrapper; concatenating only part of the dropzone source into a combined assets file (as this webapp does with uncompressed assets).
Related errors
- Invalid dropzone element.
- Dropzone already attached.
- No URL provided.
- You can't provide both 'acceptedFiles' and 'acceptedMimeType
- This file can't be queued because it has already been proces
AI-assisted analysis of dianping/cat@e815e74d4c (2026-08-14).
Data as JSON: /api/errors/3fe075bc6e8fe831.
Report an issue: GitHub.