{"record":{"id":"b3b0cf0a9aa9f9f2","repo":"apple/pkl","slug":"ioerrorresolvingglob","errorCode":"ioErrorResolvingGlob","errorMessage":"I/O error resolving glob pattern `{0}`.","messagePattern":"I/O error resolving glob pattern `(.+?)`\\.","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/expression/unary/ImportGlobNode.java","lineNumber":98,"sourceCode":"        throw exceptionBuilder()\n            .evalError(\"cannotGlobUri\", importUri, importUri.getScheme())\n            .build();\n      }\n      var resolvedElements =\n          GlobResolver.resolveGlob(\n              context.getSecurityManager(),\n              moduleKey,\n              currentModule.getOriginal(),\n              currentModule.getUri(),\n              globPattern);\n      var builder = new VmObjectBuilder(resolvedElements.size());\n      for (var entry : resolvedElements.entrySet()) {\n        builder.addEntry(entry.getKey(), getMemberNode());\n      }\n      cachedResult = builder.toMapping(resolvedElements);\n      return cachedResult;\n    } catch (IOException e) {\n      throw exceptionBuilder().evalError(\"ioErrorResolvingGlob\", importUri).withCause(e).build();\n    } catch (SecurityManagerException | HttpClientException e) {\n      throw exceptionBuilder().withCause(e).build();\n    } catch (PackageLoadError e) {\n      throw exceptionBuilder().adhocEvalError(e.getMessage()).build();\n    } catch (InvalidGlobPatternException e) {\n      throw exceptionBuilder()\n          .evalError(\"invalidGlobPattern\", globPattern)\n          .withHint(e.getMessage())\n          .build();\n    } catch (ExternalReaderProcessException e) {\n      throw exceptionBuilder().evalError(\"externalReaderFailure\").withCause(e).build();\n    }\n  }\n}\n","sourceCodeStart":80,"sourceCodeEnd":113,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/expression/unary/ImportGlobNode.java#L80-L113","documentation":"Pkl throws this when resolving a glob import (enumerating the files matching the pattern) fails with an IOException that is not attributable to another specific handler — e.g. I/O trouble while listing directory entries or fetching remote elements. The import URI is reported and the IOException is attached as cause.","triggerScenarios":"Evaluating a glob import where directory enumeration fails: unreadable directory, network failure during a remote glob resolution, or an interrupted filesystem operation.","commonSituations":"Globbing a directory without read/execute permissions; glob over a network-mounted path that dropped; transient network error while globbing package contents.","solutions":["Check permissions on the directory being globbed (needs read/execute).","Verify network/storage availability if the glob path is remote or on a mount.","Inspect the cause chain for the exact IOException and address that failure.","Retry the evaluation if the failure was transient."],"exampleFix":"// before\nimport \"/root-protected/*.pkl\" as mods*  // permission denied\n// after\nchmod +rx /root-protected  // or glob a readable directory\nimport \"./configs/*.pkl\" as mods*","handlingStrategy":"retry","validationCode":"// Host-side pre-check: directory exists and is readable\n//   Files.isDirectory(dir) && Files.isReadable(dir)","typeGuard":null,"tryCatchPattern":"// Retry transient failures around evaluation:\nfor (attempt in 1..3) {\n  try { return eval(); }\n  catch (PklException e) {\n    if (e.message?.contains(\"I/O error resolving glob\") == true && attempt < 3) { backoff(); continue; }\n    throw e;\n  }\n}","preventionTips":["Ensure glob target directories are readable/executable by the evaluating user.","Avoid globbing across flaky network mounts; copy locally first.","Run evaluations on stable storage with reliable connectivity."],"tags":["glob","io","import","filesystem","pkl"],"backgroundTag":"file-read-failed","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}