{"record":{"id":"a727d77319a47253","repo":"BookStackApp/BookStack","slug":"failed-loading-module-from-modulejsonfile-wit","errorCode":null,"errorMessage":"Failed loading module from \"{$moduleJsonFile}\" with error: {$exception->getMessage()}","messagePattern":"Failed loading module from \"(.+?)\" with error: (.+?)","errorType":"exception","errorClass":"ThemeModuleException","httpStatus":null,"severity":"error","filePath":"app/Theming/ThemeModuleManager.php","lineNumber":135,"sourceCode":"    {\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":117,"sourceCodeEnd":141,"githubUrl":"https://github.com/BookStackApp/BookStack/blob/18f8469a1c72f8cc8497e9372635e6dea5028071/app/Theming/ThemeModuleManager.php#L117-L141","documentation":"Wrapping ThemeModuleException rethrown in ThemeModuleManager::loadFromFolder when loading a module manifest fails for any reason (bad JSON or ThemeModule::fromJson validation failure); the original error text is embedded so the root cause of the failed module load is preserved.","triggerScenarios":"Thrown at app/Theming/ThemeModuleManager.php:135 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the embedded original error message to identify whether it is invalid JSON or a missing/invalid manifest property","Fix the bookstack-module.json accordingly (syntax or required name/description/version fields)","Reinstall the theme module from a fresh copy if the file is corrupt"],"exampleFix":null,"handlingStrategy":"fallback","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"}