{"record":{"id":"051f28629e80b0e6","repo":"BookStackApp/BookStack","slug":"invalid-json-in-module-file-at-modulejsonfile","errorCode":null,"errorMessage":"Invalid JSON in module file at \"{$moduleJsonFile}\": ","messagePattern":"Invalid JSON in module file at \"(.+?)\": ","errorType":"exception","errorClass":"ThemeModuleException","httpStatus":null,"severity":"error","filePath":"app/Theming/ThemeModuleManager.php","lineNumber":128,"sourceCode":"\n        $this->loadedModules = $modules;\n\n        return $modules;\n    }\n\n    protected function loadFromFolder(string $folderName): ThemeModule|null\n    {\n        $moduleJsonFile = $this->modulesFolderPath . DIRECTORY_SEPARATOR . $folderName . DIRECTORY_SEPARATOR . 'bookstack-module.json';\n        if (!file_exists($moduleJsonFile)) {\n            return null;\n        }\n\n        try {\n            $jsonContent = file_get_contents($moduleJsonFile);\n            $jsonData = json_decode($jsonContent, true);\n\n            if (json_last_error() !== JSON_ERROR_NONE) {\n                throw new ThemeModuleException(\"Invalid JSON in module file at \\\"{$moduleJsonFile}\\\": \" . json_last_error_msg());\n            }\n\n            $module = ThemeModule::fromJson($jsonData, $folderName);\n        } catch (ThemeModuleException $exception) {\n            throw $exception;\n        } catch (\\Exception $exception) {\n            throw new ThemeModuleException(\"Failed loading module from \\\"{$moduleJsonFile}\\\" with error: {$exception->getMessage()}\");\n        }\n\n        return $module;\n    }\n}\n","sourceCodeStart":110,"sourceCodeEnd":141,"githubUrl":"https://github.com/BookStackApp/BookStack/blob/18f8469a1c72f8cc8497e9372635e6dea5028071/app/Theming/ThemeModuleManager.php#L110-L141","documentation":"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.","triggerScenarios":"Thrown at app/Theming/ThemeModuleManager.php:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"18f8469a1c72f8cc8497e9372635e6dea5028071","analyzedAt":"2026-09-02T19:49:33.068Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}