RocketChat/Rocket.Chat · warning
Entry is not a valid JSON file; unable to import
Error message
Entry is not a valid JSON file; unable to import
What it means
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.
Source
Thrown at apps/meteor/server/lib/import/slack/SlackImporter.ts:388
// Insert the messages records
if (this.progress.step !== ProgressStep.PREPARING_MESSAGES) {
await super.updateProgress(ProgressStep.PREPARING_MESSAGES);
}
const tempMessages = JSON.parse(entry.getData().toString()) as SlackMessage[];
messagesCount += tempMessages.length;
await this.updateRecord({ messagesstatus: `${channel}/${date}` });
await this.addCountToTotal(tempMessages.length);
const slackChannelId = await ImportData.findChannelImportIdByNameOrImportId(channel);
if (slackChannelId) {
for (const message of tempMessages) {
await this.prepareMessageObject(message, missedTypes, slackChannelId);
}
}
} catch (error) {
this.logger.warn({ msg: 'Entry is not a valid JSON file; unable to import', entryName: entry.entryName, err: error });
}
}
} catch (err) {
this.logger.error({ msg: 'Error processing message entry', err });
}
increaseProgress();
}
if (Object.keys(missedTypes).length > 0) {
this.logger.info({ msg: 'Missed import types', missedTypes });
}
} catch (err) {
this.logger.error({ msg: 'Error preparing import using local file', err });
throw err;
}
ImporterWebsocket.progressUpdated({ rate: 100 });View on GitHub (pinned to b2c16d5842)
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
Defensive patterns
Strategy: validation
Validate before calling
// pre-validate each entry before handing it to the importer
function isParsableEntry(data: Buffer): boolean {
try {
JSON.parse(data.toString('utf8'));
return true;
} catch {
return false;
}
} Try / catch
try {
tempMessages = JSON.parse(entry.getData().toString('utf8'));
} catch (error) {
this.logger.warn({ msg: 'Entry is not a valid JSON file; unable to import', entryName: entry.entryName, err: error });
continue; // skip this file; the rest of the import proceeds
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
Related errors
- error-importer-not-defined
- Failed to create new room
- The file contains invalid syntax
- Failed to set user avatar from pending URL
- Failed to import the parent comment; missing replies/reply_u
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/fe46d8430e5ac1ff.
Report an issue: GitHub.