{"record":{"id":"2fedd39b98ca7852","repo":"dianping/cat","slug":"this-file-can-t-be-queued-because-it-has-already-b","errorCode":null,"errorMessage":"This file can't be queued because it has already been processed or was rejected.","messagePattern":"This file can't be queued because it has already been processed or was rejected\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cat-home/src/main/webapp/assets/js/uncompressed/dropzone.js","lineNumber":1156,"sourceCode":"      for (_i = 0, _len = files.length; _i < _len; _i++) {\n        file = files[_i];\n        this.enqueueFile(file);\n      }\n      return null;\n    };\n\n    Dropzone.prototype.enqueueFile = function(file) {\n      if (file.status === Dropzone.ADDED && file.accepted === true) {\n        file.status = Dropzone.QUEUED;\n        if (this.options.autoProcessQueue) {\n          return setTimeout(((function(_this) {\n            return function() {\n              return _this.processQueue();\n            };\n          })(this)), 0);\n        }\n      } else {\n        throw new Error(\"This file can't be queued because it has already been processed or was rejected.\");\n      }\n    };\n\n    Dropzone.prototype._thumbnailQueue = [];\n\n    Dropzone.prototype._processingThumbnail = false;\n\n    Dropzone.prototype._enqueueThumbnail = function(file) {\n      if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {\n        this._thumbnailQueue.push(file);\n        return setTimeout(((function(_this) {\n          return function() {\n            return _this._processThumbnailQueue();\n          };\n        })(this)), 0);\n      }\n    };\n","sourceCodeStart":1138,"sourceCodeEnd":1174,"githubUrl":"https://github.com/dianping/cat/blob/e815e74d4c2dd74edac831241f1253fcc7d25381/cat-home/src/main/webapp/assets/js/uncompressed/dropzone.js#L1138-L1174","documentation":"enqueueFile(file) manually adds a file to the upload queue, but only files in the ADDED state that passed acceptance (file.accepted === true) may be queued. Any other status (QUEUED, UPLOADING, ACCEPTED, REJECTED, CANCELED, ERROR) throws, because re-queuing a processed or rejected file would corrupt the queue.","triggerScenarios":"Calling dz.enqueueFile(file) on a file already auto-queued (autoProcessQueue true queues immediately); calling it on a file rejected by accept(); calling it twice for the same file object; passing a plain object that is not a Dropzone file (status undefined).","commonSituations":"Using autoProcessQueue:false with manual enqueue plus dropzone's own automatic enqueue of accepted files; retry buttons that re-enqueue the original file object instead of re-adding it; custom accept() callbacks that forget to call done().","solutions":["Only enqueue files whose status is Dropzone.ADDED and accepted === true; check before calling.","With autoProcessQueue:true, do not call enqueueFile at all — accepted files are queued automatically.","To retry an upload, use dz.processQueue() on queued files or removeFile(file) then addFile(file) again rather than enqueueFile.","In a custom accept(), always invoke done() so accepted is set."],"exampleFix":"// before\ndz.enqueueFile(file); // file.status may already be QUEUED/REJECTED\n\n// after\nif (file.status === Dropzone.ADDED && file.accepted === true) {\n  dz.enqueueFile(file);\n} else if (file.status === Dropzone.REJECTED || file.status === Dropzone.ERROR) {\n  dz.removeFile(file);\n  dz.addFile(file); // re-run acceptance pipeline\n}","handlingStrategy":"type-guard","validationCode":"function isQueueable(file) {\n  return file && file.status === Dropzone.ADDED && file.accepted === true;\n}\nif (isQueueable(file)) dz.enqueueFile(file);","typeGuard":"function isQueueableDropzoneFile(file) {\n  return file != null && typeof file === 'object' &&\n    typeof file.status === 'string' && file.status === Dropzone.ADDED &&\n    file.accepted === true;\n}","tryCatchPattern":null,"preventionTips":["With autoProcessQueue:true never call enqueueFile — files queue themselves.","Implement retry as removeFile + addFile, not enqueueFile on the same object.","Always call done() inside custom accept() callbacks so accepted is set."],"tags":["dropzone","queue","file-state","upload","vendor"],"backgroundTag":null,"analyzedSha":"e815e74d4c2dd74edac831241f1253fcc7d25381","analyzedAt":"2026-08-14T14:22:34.512Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}