{"record":{"id":"507a6dc081a2a7d6","repo":"1Panel-dev/1Panel","slug":"not-regular-file","errorCode":null,"errorMessage":"not-regular-file","messagePattern":"not-regular-file","errorType":"console","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/openresty-modules/diagnose-install.sh","lineNumber":225,"sourceCode":"    for build in module.get(\"builds\") or []:\n        target_key = (build.get(\"target\") or {}).get(\"key\", \"\")\n        for artifact in build.get(\"artifacts\") or []:\n            relative = artifact.get(\"path\", \"\")\n            expected = artifact.get(\"checksum\", \"\")\n            result = \"OK\"\n            actual = \"\"\n            try:\n                pure = pathlib.PurePosixPath(relative)\n                if not relative or pure.is_absolute() or \"..\" in pure.parts or \"\\\\\" in relative:\n                    raise ValueError(\"unsafe-path\")\n                candidate = modules_root / pathlib.Path(*pure.parts)\n                if candidate.is_symlink():\n                    raise ValueError(\"symlink-not-allowed\")\n                full_path = candidate.resolve(strict=True)\n                if modules_root not in full_path.parents:\n                    raise ValueError(\"outside-module-root\")\n                if not full_path.is_file():\n                    raise ValueError(\"not-regular-file\")\n                digest = hashlib.sha256()\n                with full_path.open(\"rb\") as handle:\n                    for chunk in iter(lambda: handle.read(1024 * 1024), b\"\"):\n                        digest.update(chunk)\n                actual = digest.hexdigest()\n                if actual.lower() != expected.lower():\n                    raise ValueError(\"checksum-mismatch\")\n            except Exception as error:\n                result = str(error)\n                failed = True\n            print(\"\\t\".join([\n                module.get(\"name\", \"\"), build.get(\"status\", \"\"), target_key,\n                relative, expected, actual, result,\n            ]))\nsys.exit(1 if failed else 0)\nPY\n    then\n        mark_passed \"artifact paths and checksums\"","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/1Panel-dev/1Panel/blob/5ac7c808815b0691009cd390414f03471312262f/scripts/openresty-modules/diagnose-install.sh#L207-L243","documentation":"Raised when the resolved path exists and is inside the modules root but is not a regular file (full_path.is_file() is false): it is a directory, fifo, socket, device, or was deleted between resolve and the check.","triggerScenarios":"A manifest artifact 'path' names a directory (e.g. 'lua/lib'); the artifact is a unix socket or fifo; a concurrent cleanup removed the file after resolve(strict=True) succeeded.","commonSituations":"Manifest recorded the output directory instead of the .so file; a failed build left only directories; another process (upgrader, cleaner) raced the diagnostic.","solutions":["Point the manifest entry at the actual module file (the .so/.lua file), not its directory","Rebuild the module so the real artifact is produced under the modules root, then re-run diagnose-install.sh","If it is intermittent, stop concurrent openresty upgrade/clean jobs before diagnosing"],"exampleFix":"// manifest before\n{\"path\": \"lua/resty/http\", \"checksum\": \"...\"}\n// manifest after\n{\"path\": \"lua/resty/http.lua\", \"checksum\": \"...\"}","handlingStrategy":"validation","validationCode":"python3 -c \"import pathlib; p=pathlib.Path('/opt/1panel/openresty/modules')/artifact_rel; assert p.is_file(), p\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert each manifest entry points at a regular file in the build script that writes the manifest","Verify artifacts exist and are files immediately after install, before running the diagnostic"],"tags":["filesystem","openresty","validation"],"backgroundTag":null,"analyzedSha":"5ac7c808815b0691009cd390414f03471312262f","analyzedAt":"2026-08-15T14:02:06.953Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}