{"record":{"id":"d2ae801146ea0065","repo":"MagicMirrorOrg/MagicMirror","slug":"warning-your-custom-css-file-is-currently-located","errorCode":null,"errorMessage":"WARNING! Your custom css file is currently located in the css folder. Please move it to the config folder!","messagePattern":"WARNING! Your custom css file is currently located in the css folder\\. Please move it to the config folder!","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"js/app.js","lineNumber":207,"sourceCode":"\t\t\tglobal.config = configObj.fullConf;\n\t\t\t// Keep a copy of the redacted config to later verify module secret permissions\n\t\t\tglobal.configRedacted = configObj.redactedConf;\n\t\t\tconst config = global.config;\n\t\t\tUtils.checkConfigFile(configObj);\n\n\t\t\tglobal.defaultModulesDir = config.defaultModulesDir;\n\t\t\tdefaultModules = require(`${global.root_path}/${global.defaultModulesDir}/defaultmodules`);\n\n\t\t\tLog.setLogLevel(config.logLevel);\n\n\t\t\tenv = getEnvVarsAsObj();\n\t\t\t// check for deprecated css/custom.css and move it to new location\n\t\t\tif ((!fs.existsSync(`${global.root_path}/${env.customCss}`)) && (fs.existsSync(`${global.root_path}/css/custom.css`))) {\n\t\t\t\ttry {\n\t\t\t\t\tfs.renameSync(`${global.root_path}/css/custom.css`, `${global.root_path}/${env.customCss}`);\n\t\t\t\t\tLog.warn(`WARNING! Your custom css file was moved from ${global.root_path}/css/custom.css to ${global.root_path}/${env.customCss}`);\n\t\t\t\t} catch {\n\t\t\t\t\tLog.warn(\"WARNING! Your custom css file is currently located in the css folder. Please move it to the config folder!\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// get the used module positions\n\t\t\tUtils.getModulePositions();\n\n\t\t\tlet modules = [];\n\t\t\tfor (const module of config.modules) {\n\t\t\t\tif (module.disabled) continue;\n\t\t\t\tif (module.module) {\n\t\t\t\t\tif (Utils.moduleHasValidPosition(module.position) || typeof (module.position) === \"undefined\") {\n\t\t\t\t\t\t// Only add this module to be loaded if it is not a duplicate (repeated instance of the same module)\n\t\t\t\t\t\tif (!modules.includes(module.module)) {\n\t\t\t\t\t\t\tmodules.push(module.module);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tLog.warn(\"Invalid module position found for this configuration:\" + `\\n${JSON.stringify(module, null, 2)}`);\n\t\t\t\t\t}","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/MagicMirrorOrg/MagicMirror/blob/4b4a59534f7da01e4030e46029fe9dd649a7675e/js/app.js#L189-L225","documentation":"During MagicMirror startup, App checks for the deprecated css/custom.css location and tries to auto-migrate it to the config folder (config/custom.css). If fs.renameSync fails — typically a permissions problem or the file being open/locked — the app cannot move it and logs this warning telling the user to move it manually.","triggerScenarios":"config.customCss points to config/custom.css (default), css/custom.css exists, and the fs.renameSync migration throws (e.g. EACCES on the css/ or config/ directory, read-only filesystem, or the file is locked by another process).","commonSituations":"Users upgrading MagicMirror from versions where custom.css lived in css/; Docker/container or hosted installs where the user running the server lacks write permission to css/ or config/; the old file owned by root after a sudo install.","solutions":["Manually move the file: mv css/custom.css config/custom.css","Fix permissions on the css/ and config/ directories (chown to the user running MagicMirror, chmod u+w).","If you intentionally keep it in css/, set customCss in config.js (env CUSTOMCSS) to point at css/custom.css so the check passes.","Re-run MagicMirror as the correct non-root user instead of sudo so future migrations succeed."],"exampleFix":"// before (shell)\ncss/custom.css owned by root, server runs as 'pi'\n// after (shell)\nsudo chown pi:pi css/custom.css && mv css/custom.css config/custom.css","handlingStrategy":"fallback","validationCode":"const fs = require(\"fs\");\nif (fs.existsSync(\"css/custom.css\")) {\n  try { fs.accessSync(\"css/custom.css\", fs.constants.W_OK); fs.accessSync(\"config/\", fs.constants.W_OK); }\n  catch { console.warn(\"Move css/custom.css to config/custom.css manually (permissions issue)\"); }\n}","typeGuard":"function canMigrate(src, destDir) {\n  try { fs.accessSync(src, fs.constants.W_OK); fs.accessSync(destDir, fs.constants.W_OK); return true; }\n  catch { return false; }\n}","tryCatchPattern":"try {\n  fs.renameSync(\"css/custom.css\", \"config/custom.css\");\n} catch (err) {\n  Log.warn(\"Auto-migration failed (\" + err.code + \"); move css/custom.css manually\");\n}","preventionTips":["After upgrading, proactively check whether css/custom.css exists and move it yourself.","Run MagicMirror as a user with write access to the css/ and config/ directories.","Avoid sudo-running the server, which leaves root-owned files behind."],"tags":["filesystem","migration","deprecation","permissions"],"backgroundTag":"file-permission-denied","analyzedSha":"4b4a59534f7da01e4030e46029fe9dd649a7675e","analyzedAt":"2026-08-31T21:49:42.591Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}