{"record":{"id":"85836b3c80722ef8","repo":"apple/pkl","slug":"ioerrorloadingmodule-85836b","errorCode":"ioErrorLoadingModule","errorMessage":"ioErrorLoadingModule ${importUri}","messagePattern":"ioErrorLoadingModule (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java","lineNumber":3257,"sourceCode":"\n      var exceptionBuilder =\n          exceptionBuilder()\n              .evalError(\"cannotFindModule\", importUri)\n              .withSourceSection(createSourceSection(ctx));\n      var path = parsedUri.getPath();\n      if (path != null && path.contains(\"\\\\\")) {\n        exceptionBuilder.withHint(\n            \"To resolve modules in nested directories, use `/` as the directory separator.\");\n      }\n      throw exceptionBuilder.build();\n    } catch (URISyntaxException e) {\n      throw exceptionBuilder()\n          .evalError(\"invalidModuleUri\", importUri)\n          .withHint(e.getReason())\n          .withSourceSection(createSourceSection(ctx))\n          .build();\n    } catch (IOException e) {\n      throw exceptionBuilder()\n          .evalError(\"ioErrorLoadingModule\", importUri)\n          .withCause(e)\n          .withSourceSection(createSourceSection(ctx))\n          .build();\n    } catch (SecurityManagerException | PackageLoadError e) {\n      throw exceptionBuilder().withSourceSection(createSourceSection(ctx)).withCause(e).build();\n    } catch (VmException e) {\n      throw exceptionBuilder()\n          .evalError(e.getMessage(), e.getMessageArguments())\n          .withCause(e.getCause())\n          .withHintBuilder(e.getHintBuilder())\n          .withSourceSection(createSourceSection(ctx))\n          .build();\n    } catch (ExternalReaderProcessException e) {\n      throw exceptionBuilder()\n          .evalError(\"externalReaderFailure\")\n          .withCause(e.getCause())\n          .withSourceSection(createSourceSection(ctx))","sourceCodeStart":3239,"sourceCodeEnd":3275,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java#L3239-L3275","documentation":"Thrown when reading/fetching an imported module from its resolved URI raised an IOException — the URI was valid but the module could not be loaded from disk/network. The original IOException is attached as the cause.","triggerScenarios":"An `import` whose target file does not exist, is a directory, or whose network fetch (http(s) module, package) failed with an I/O error during `resolveImport`.","commonSituations":"Typos in the module path; file moved/renamed after the import was written; offline environment when importing remote modules; missing package resources.","solutions":["Check the file/directory path in the import and the attached cause message","Verify the imported file exists relative to the importing module","Check network access/proxy settings for remote imports","Re-run `pkl project resolve` if dependencies are missing"],"exampleFix":"// before (file missing)\nimport \"../shared/base.pkl\"\n// after\nimport \"../common/base.pkl\" // corrected path after file was moved","handlingStrategy":"try-catch","validationCode":"// before eval, verify imported files exist:\n// test -f path/to/imported.pkl || echo \"missing module\"","typeGuard":null,"tryCatchPattern":"// CLI: pkl eval module.pkl 2>err.log; check err.log for ioErrorLoadingModule and the caused-by IOException","preventionTips":["Verify all imported files exist in the repo and in CI","Pin project dependencies and run `pkl project resolve`","Check network/VPN availability for remote module imports"],"tags":["pkl","import","io","module-loading"],"backgroundTag":"file-not-found","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}