BookStackApp/BookStack · error · ThemeModuleException
Invalid JSON in module file at "{$moduleJsonFile}":
Error message
Invalid JSON in module file at "{$moduleJsonFile}": What it means
ThemeModuleException thrown in ThemeModuleManager::loadFromFolder when json_decode of the module's bookstack-module.json fails (json_last_error not JSON_ERROR_NONE). Input at fault: a malformed JSON manifest file in the theme modules folder.
Source
Thrown at app/Theming/ThemeModuleManager.php:128
$this->loadedModules = $modules;
return $modules;
}
protected function loadFromFolder(string $folderName): ThemeModule|null
{
$moduleJsonFile = $this->modulesFolderPath . DIRECTORY_SEPARATOR . $folderName . DIRECTORY_SEPARATOR . 'bookstack-module.json';
if (!file_exists($moduleJsonFile)) {
return null;
}
try {
$jsonContent = file_get_contents($moduleJsonFile);
$jsonData = json_decode($jsonContent, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new ThemeModuleException("Invalid JSON in module file at \"{$moduleJsonFile}\": " . json_last_error_msg());
}
$module = ThemeModule::fromJson($jsonData, $folderName);
} catch (ThemeModuleException $exception) {
throw $exception;
} catch (\Exception $exception) {
throw new ThemeModuleException("Failed loading module from \"{$moduleJsonFile}\" with error: {$exception->getMessage()}");
}
return $module;
}
}
View on GitHub (pinned to 18f8469a1c)
Solutions
- Open the bookstack-module.json file and fix JSON syntax errors (the message includes json_last_error_msg)
- Validate the JSON with a linter before installing the module
- Re-download/reinstall the module in case its manifest is corrupted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/Theming/ThemeModuleManager.php:128 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of BookStackApp/BookStack@18f8469a1c (2026-09-02).
Data as JSON: /api/errors/051f28629e80b0e6.
Report an issue: GitHub.