{"record":{"id":"5ccac3b910529a93","repo":"apple/pkl","slug":"invalidmoduleoutput","errorCode":"invalidModuleOutput","errorMessage":"invalidModuleOutput","messagePattern":"invalidModuleOutput","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java","lineNumber":331,"sourceCode":"\n  @Override\n  public <T> T evaluateOutputValueAs(ModuleSource moduleSource, PClassInfo<T> classInfo) {\n    return doEvaluate(\n        moduleSource,\n        (module) -> {\n          var output = VmUtils.readModuleOutput(module);\n          var value = VmUtils.readMember(output, Identifier.VALUE);\n          var valueClassInfo = VmUtils.getClass(value).getPClassInfo();\n          if (valueClassInfo.equals(classInfo)) {\n            if (value instanceof VmValue vmValue) {\n              vmValue.force(false);\n              //noinspection unchecked\n              return (T) vmValue.export();\n            }\n            //noinspection unchecked\n            return (T) value;\n          }\n          throw moduleOutputValueTypeMismatch(module, classInfo, value, output);\n        });\n  }\n\n  @Override\n  public void close() {\n    // if currently executing, blocks until cancellation has completed (see\n    // https://github.com/oracle/graal/issues/1230)\n    polyglotContext.close(true);\n    try {\n      packageResolver.close();\n    } catch (IOException ignored) {\n    }\n\n    if (timeoutExecutor != null) {\n      timeoutExecutor.shutdown();\n    }\n  }\n","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java#L313-L349","documentation":"Sentinel error 'invalidModuleOutput' in EvaluatorImpl.evaluateOutputValueAs: after forcing the module's `output.value`, the value's PClassInfo does not match the classInfo requested by the caller, so the result cannot be returned as the expected type. The input at fault is a module whose output.value is not an instance of the requested PClassInfo.","triggerScenarios":"Thrown at pkl-core/src/main/java/org/pkl/core/EvaluatorImpl.java:331 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the module's output.value conform to the requested type (check the class in the Pkl source).","Request the correct PClassInfo matching what the module actually outputs."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}