{"record":{"id":"caf79f10e803aa89","repo":"yiisoft/yii2","slug":"unable-to-write-template-file-configfile","errorCode":null,"errorMessage":"Unable to write template file '{$configFile}'.","messagePattern":"Unable to write template file '(.+?)'\\.","errorType":"console","errorClass":"yii\\console\\Exception","httpStatus":null,"severity":"error","filePath":"framework/console/controllers/AssetController.php","lineNumber":748,"sourceCode":"            'baseUrl' => '@web/assets',\n            'js' => 'js/all-{hash}.js',\n            'css' => 'css/all-{hash}.css',\n        ],\n    ],\n    // Asset manager configuration:\n    'assetManager' => [\n        //'basePath' => '@webroot/assets',\n        //'baseUrl' => '@web/assets',\n    ],\n];\nEOD;\n        if (file_exists($configFile)) {\n            if (!$this->confirm(\"File '{$configFile}' already exists. Do you wish to overwrite it?\")) {\n                return ExitCode::OK;\n            }\n        }\n        if (!file_put_contents($configFile, $template, LOCK_EX)) {\n            throw new Exception(\"Unable to write template file '{$configFile}'.\");\n        }\n\n        $this->stdout(\"Configuration file template created at '{$configFile}'.\\n\\n\", Console::FG_GREEN);\n        return ExitCode::OK;\n    }\n\n    /**\n     * Returns canonicalized absolute pathname.\n     * Unlike regular `realpath()` this method does not expand symlinks and does not check path existence.\n     * @param string $path raw path\n     * @return string canonicalized absolute pathname\n     */\n    private function findRealPath($path)\n    {\n        $path = str_replace(['/', '\\\\'], DIRECTORY_SEPARATOR, $path);\n        $pathParts = explode(DIRECTORY_SEPARATOR, $path);\n\n        $realPathParts = [];","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/console/controllers/AssetController.php#L730-L766","documentation":"Error \"Unable to write template file '{$configFile}'.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/console/controllers/AssetController.php:748 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}