{"record":{"id":"a1e6ba18f397708e","repo":"apple/pkl","slug":"rethrown-vmexception-message-dynamic","errorCode":null,"errorMessage":"rethrown VmException message (dynamic)","messagePattern":"rethrown VmException message \\(dynamic\\)","errorType":"exception","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java","lineNumber":3265,"sourceCode":"            \"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))\n          .build();\n    }\n\n    if (!resolvedUri.isAbsolute()) {\n      throw exceptionBuilder()\n          .evalError(\"cannotHaveRelativeImport\", moduleKey.getUri())\n          .withSourceSection(createSourceSection(ctx))\n          .build();","sourceCodeStart":3247,"sourceCodeEnd":3283,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/builder/AstBuilder.java#L3247-L3283","documentation":"If module resolution itself throws a VmException, the builder re-raises it as an eval error preserving the VmException's message, message arguments, hint, and cause. The dynamic message text therefore depends on the underlying resolution failure.","triggerScenarios":"Any module-load step inside `resolveImport` (e.g. a nested import cycle detected, an evaluation error inside the imported module's loader) that surfaces as a VmException.","commonSituations":"Import chains failing deep inside a dependency; chained module errors where the root cause is an earlier throw wrapped as VmException.","solutions":["Read the rendered message and its cause chain to find the original failure","Fix the specific resolution problem the message describes (path, syntax, or dependency)","Re-run with verbose/stack-trace output to locate the originating module"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Catch the PklError, then walk getCause() chain to the original VmException and log its message + hints","preventionTips":["Fix module resolution failures reported in the wrapped message","Avoid deep import chains that make wrapped errors hard to trace","Run failing imports in isolation to get the unwrapped error"],"tags":["pkl","import","vm-exception","module-loading"],"backgroundTag":"module-init-failed","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"}