apple/pkl · error · URISyntaxException

invalidTripleDotSyntax

invalidTripleDotSyntax

Error message

expected `...` or `.../path/to/my_module.pkl`

What it means

When parsing a triple-dot import URI, the scheme-specific part must be exactly '...' or '.../path'. This URISyntaxException is thrown for malformed forms like '..' + non-slash character (e.g. '..foo' or '...path' without the slash after the dots).

Source

Thrown at pkl-core/src/main/java/org/pkl/core/util/IoUtils.java:636

    // This only influences the behavior of the revocation checker.
    // Otherwise, proxying is handled by [ProxySelector].
    System.setProperty("http.proxyHost", proxyAddress.getHost());
    System.setProperty(
        "http.proxyPort",
        proxyAddress.getPort() == -1 ? "80" : String.valueOf(proxyAddress.getPort()));
  }

  public static @Nullable String parseTripleDotPath(URI importUri) throws URISyntaxException {
    var importScheme = importUri.getScheme();
    if (importScheme != null) return null;

    var schemeSpecificPart = importUri.getSchemeSpecificPart();
    if (!schemeSpecificPart.startsWith("...")) return null;

    if (schemeSpecificPart.length() == 3) return "";

    if (schemeSpecificPart.charAt(3) != '/' || schemeSpecificPart.length() == 4) {
      throw new URISyntaxException(
          importUri.toString(), ErrorMessages.create("invalidTripleDotSyntax"));
    }

    return schemeSpecificPart.substring(4);
  }

  public static String toUnicodeEscape(int ch) {
    var hex = Integer.toHexString(ch);
    return switch (hex.length()) {
      case 1 -> "\\u000" + hex;
      case 2 -> "\\u00" + hex;
      case 3 -> "\\u0" + hex;
      case 4 -> "\\u" + hex;
      default -> throw new IllegalArgumentException(String.valueOf(ch));
    };
  }

  public static String toHexEscape(int ch) {

View on GitHub (pinned to f3efcbfc9b)

Solutions

  1. Write either bare `...` or `.../path/to/module.pkl` with a slash immediately after the dots
  2. Remove stray characters between the dots and the path
  3. If a plain relative import is intended, drop the dots entirely (e.g. `import "sub/mod.pkl"`)

Example fix

// before
import "...my_module.pkl"
// after
import ".../path/to/my_module.pkl"
Defensive patterns

Strategy: validation

Validate before calling

if (s.startsWith("...") && s.length() > 3 && s.charAt(3) != '/') throw new IllegalArgumentException("use '...' or '.../path'");

Type guard

function isValidTripleDot(s) { return s === "..." || /^\.\.\.\/.+/.test(s); }

Try / catch

try { parseTripleDot(uri) } catch (URISyntaxException e) { /* report invalidTripleDotSyntax with correct form */ }

Prevention

When it happens

Trigger: An import string like `import "...foo"` or `import ".../ "`-less variants: the 4th character after the leading '...' exists but is not '/', or the part is exactly 4 chars (e.g. '.../').

Common situations: Typo in a triple-dot import — missing slash, extra characters glued to the dots, or an over-abbreviated relative import like `.../` with no path.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08). Data as JSON: /api/errors/9f3148839eeb1a0e. Report an issue: GitHub.