{"record":{"id":"1ad15765d07c7371","repo":"apple/pkl","slug":"cannotexportvalue-1ad157","errorCode":"cannotExportValue","errorMessage":"cannotExportValue","messagePattern":"cannotExportValue","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/runtime/VmIntSeq.java","lineNumber":67,"sourceCode":"    return step > 0 ? start > last : start < last;\n  }\n\n  public long getLength() {\n    if (isEmpty()) return 0;\n    return (Math.abs((end - start) / step)) + 1;\n  }\n\n  @Override\n  public VmClass getVmClass() {\n    return BaseModule.getIntSeqClass();\n  }\n\n  @Override\n  public void force(boolean allowUndefinedValues) {}\n\n  @Override\n  public Object export() {\n    throw new VmExceptionBuilder().evalError(\"cannotExportValue\", getVmClass()).build();\n  }\n\n  @Override\n  public void accept(VmValueVisitor visitor) {\n    visitor.visitIntSeq(this);\n  }\n\n  @Override\n  public <T> T accept(VmValueConverter<T> converter, Iterable<Object> path) {\n    return converter.convertIntSeq(this, path);\n  }\n\n  @Override\n  public PrimitiveIterator.OfLong iterator() {\n    return new PrimitiveIterator.OfLong() {\n      boolean hasNext = !isEmpty();\n      long next = hasNext ? start : last;\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/runtime/VmIntSeq.java#L49-L85","documentation":"Thrown when a Pkl IntSeq value (a range expression like `1...5` produced as an internal VmIntSeq) is exported to a host-language value. IntSeq is an internal representation that has no host equivalent export, so `export()` unconditionally raises cannotExportValue. Developers hit it when trying to pull such a value out of an evaluation result via the Java API.","triggerScenarios":"Calling EvalResult.get() / export on a property whose value is an internal IntSeq (range) object instead of a rendered List.","commonSituations":"Binding code that reads a Pkl property defined as a range expression; host code expecting a list/array but the range was never converted (e.g. via .toList()) inside Pkl.","solutions":["Convert the range to a concrete value in Pkl before exporting: `myProp = (1...5).toList()`.","On the host side, avoid exporting raw ranges; only export Lists, Mappings, and primitives.","If you control the schema, change the property type to `List<Int>`.","Intercept in host code and detect IntSeq-shaped results, rendering them yourself."],"exampleFix":"// Pkl before\nfoo = 1...5\n// Pkl after\nfoo = (1...5).toList()","handlingStrategy":"validation","validationCode":"// Pkl-side guard\nassert foo is List<Int> // ensure the property is a concrete List before export","typeGuard":null,"tryCatchPattern":"try {\n  Object v = result.get(\"foo\");\n} catch (EvalException e) {\n  if (e.getMessage().contains(\"cannotExportValue\")) {\n    // property is an internal value (e.g. IntSeq); fix the Pkl side\n  }\n}","preventionTips":["Convert ranges with .toList() inside Pkl before exporting.","Give exported properties explicit concrete types (List, Mapping, primitives).","Add `... is List<Int>` assertions in Pkl for exported properties.","Never export intermediate/internal values from your module API surface."],"tags":["pkl","export","type-mismatch","intseq"],"backgroundTag":"unsupported-operation","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}