{"record":{"id":"4798ff4794776bed","repo":"yiisoft/yii2","slug":"unable-to-open-directory-src","errorCode":null,"errorMessage":"Unable to open directory: $src","messagePattern":"Unable to open directory: \\$src","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"framework/helpers/BaseFileHelper.php","lineNumber":392,"sourceCode":"     * @throws InvalidArgumentException if unable to open directory\n     */\n    public static function copyDirectory($src, $dst, $options = [])\n    {\n        $src = static::normalizePath($src);\n        $dst = static::normalizePath($dst);\n\n        if ($src === $dst || strpos($dst, $src . DIRECTORY_SEPARATOR) === 0) {\n            throw new InvalidArgumentException('Trying to copy a directory to itself or a subdirectory.');\n        }\n        $dstExists = is_dir($dst);\n        if (!$dstExists && (!isset($options['copyEmptyDirectories']) || $options['copyEmptyDirectories'])) {\n            static::createDirectory($dst, isset($options['dirMode']) ? $options['dirMode'] : 0775, true);\n            $dstExists = true;\n        }\n\n        $handle = opendir($src);\n        if ($handle === false) {\n            throw new InvalidArgumentException(\"Unable to open directory: $src\");\n        }\n        if (!isset($options['basePath'])) {\n            // this should be done only once\n            $options['basePath'] = realpath($src);\n            $options = static::normalizeOptions($options);\n        }\n        while (($file = readdir($handle)) !== false) {\n            if ($file === '.' || $file === '..') {\n                continue;\n            }\n            $from = $src . DIRECTORY_SEPARATOR . $file;\n            $to = $dst . DIRECTORY_SEPARATOR . $file;\n            if (static::filterPath($from, $options)) {\n                if (isset($options['beforeCopy']) && !call_user_func($options['beforeCopy'], $from, $to)) {\n                    continue;\n                }\n                if (is_file($from)) {\n                    if (!$dstExists) {","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/helpers/BaseFileHelper.php#L374-L410","documentation":"Error \"Unable to open directory: $src\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/helpers/BaseFileHelper.php:392 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"}