{"record":{"id":"fe46d8430e5ac1ff","repo":"RocketChat/Rocket.Chat","slug":"entry-is-not-a-valid-json-file-unable-to-import","errorCode":null,"errorMessage":"Entry is not a valid JSON file; unable to import","messagePattern":"Entry is not a valid JSON file; unable to import","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/meteor/server/lib/import/slack/SlackImporter.ts","lineNumber":388,"sourceCode":"\t\t\t\t\t\t\t// Insert the messages records\n\t\t\t\t\t\t\tif (this.progress.step !== ProgressStep.PREPARING_MESSAGES) {\n\t\t\t\t\t\t\t\tawait super.updateProgress(ProgressStep.PREPARING_MESSAGES);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst tempMessages = JSON.parse(entry.getData().toString()) as SlackMessage[];\n\t\t\t\t\t\t\tmessagesCount += tempMessages.length;\n\t\t\t\t\t\t\tawait this.updateRecord({ messagesstatus: `${channel}/${date}` });\n\t\t\t\t\t\t\tawait this.addCountToTotal(tempMessages.length);\n\n\t\t\t\t\t\t\tconst slackChannelId = await ImportData.findChannelImportIdByNameOrImportId(channel);\n\n\t\t\t\t\t\t\tif (slackChannelId) {\n\t\t\t\t\t\t\t\tfor (const message of tempMessages) {\n\t\t\t\t\t\t\t\t\tawait this.prepareMessageObject(message, missedTypes, slackChannelId);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthis.logger.warn({ msg: 'Entry is not a valid JSON file; unable to import', entryName: entry.entryName, err: error });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthis.logger.error({ msg: 'Error processing message entry', err });\n\t\t\t\t}\n\n\t\t\t\tincreaseProgress();\n\t\t\t}\n\n\t\t\tif (Object.keys(missedTypes).length > 0) {\n\t\t\t\tthis.logger.info({ msg: 'Missed import types', missedTypes });\n\t\t\t}\n\t\t} catch (err) {\n\t\t\tthis.logger.error({ msg: 'Error preparing import using local file', err });\n\t\t\tthrow err;\n\t\t}\n\n\t\tImporterWebsocket.progressUpdated({ rate: 100 });","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/import/slack/SlackImporter.ts#L370-L406","documentation":"The Slack importer JSON-parses each entry from the export zip (per-channel/day JSON files); JSON.parse threw, so this entry is skipped and the Slack import continues without those messages. Slack exports are known to occasionally contain invalid JSON (unescaped control characters, invalid unicode escapes, truncated files), and hand-modified exports break it far more often.","triggerScenarios":"Corrupted or truncated zip entry; Slack export containing invalid escape sequences inside message text; files re-saved with UTF-16/BOM encoding; zips recompressed or edited with tools that re-encode contents.","commonSituations":"Admins pruning or editing Slack export files before upload; interrupted downloads of the export; very old Slack exports with escaping quirks; single broken channel file blocking part of an otherwise fine import.","solutions":["Run the entryName from the log through a JSON validator; fix or drop the broken files","If a single channel file is broken, remove just that file and re-zip — the rest imports","Re-download the export from Slack if multiple files fail","Ensure files are UTF-8 without BOM"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// pre-validate each entry before handing it to the importer\nfunction isParsableEntry(data: Buffer): boolean {\n\ttry {\n\t\tJSON.parse(data.toString('utf8'));\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}","typeGuard":null,"tryCatchPattern":"try {\n\ttempMessages = JSON.parse(entry.getData().toString('utf8'));\n} catch (error) {\n\tthis.logger.warn({ msg: 'Entry is not a valid JSON file; unable to import', entryName: entry.entryName, err: error });\n\tcontinue; // skip this file; the rest of the import proceeds\n}","preventionTips":["Do not hand-edit Slack export files; if you must, re-validate them with a JSON linter","Re-download interrupted exports instead of resuming partial zips","Keep files UTF-8 without BOM when re-zipping"],"tags":["import","slack","json","importer"],"backgroundTag":"json-parse-error","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}