{"record":{"id":"33f261392428fa02","repo":"apple/pkl","slug":"invalidmoduleurimissingslash","errorCode":"invalidModuleUriMissingSlash","errorMessage":"invalidModuleUriMissingSlash","messagePattern":"invalidModuleUriMissingSlash","errorType":"error_code","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/module/ModuleKeys.java","lineNumber":384,"sourceCode":"\n    @Override\n    public boolean isLocal() {\n      return true;\n    }\n\n    @Override\n    public boolean hasHierarchicalUris() {\n      return true;\n    }\n  }\n\n  private static final class ModulePath implements ModuleKey {\n    final URI uri;\n    final ModulePathResolver resolver;\n\n    ModulePath(URI uri, ModulePathResolver resolver) {\n      if (uri.getPath() == null) {\n        throw new IllegalArgumentException(\n            ErrorMessages.create(\"invalidModuleUriMissingSlash\", uri, \"modulepath\"));\n      }\n\n      this.uri = uri;\n      this.resolver = resolver;\n    }\n\n    @Override\n    public URI getUri() {\n      return uri;\n    }\n\n    @Override\n    public boolean hasHierarchicalUris() {\n      return true;\n    }\n\n    @Override","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/module/ModuleKeys.java#L366-L402","documentation":"ModulePath module keys require URIs with a path component. If uri.getPath() returns null (an opaque URI such as foo:bar with no '/' path), the ModulePath constructor throws IllegalArgumentException with error invalidModuleUriMissingSlash, indicating the module URI is missing its '/' path part.","triggerScenarios":"Constructing a ModulePath key (directly or via ModuleKeys.forUri-style resolution of a modulepath: or classpath-style URI) with an URI that has no path component.","commonSituations":"Writing 'modulepath:my/pkg' instead of 'modulepath:/my/pkg'; programmatically building URIs without the leading slash; copy-pasted opaque URIs from other tooling.","solutions":["Add a leading slash / path component to the URI (e.g. modulepath:/my/module.pkl)","Ensure programmatically constructed URIs include a path (new URI(scheme, host, path...))","Validate URIs before passing them into Pkl module resolution"],"exampleFix":"// before\nvar uri = URI.create(\"modulepath:foo.pkl\"); // opaque, no path -> IllegalArgumentException\n// after\nvar uri = URI.create(\"modulepath:/foo.pkl\");","handlingStrategy":"validation","validationCode":"requireNonNull(uri.getPath(), \"module URI must contain a '/' path\");","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Validate URIs before module resolution"],"tags":["java","uri","module-path","validation"],"backgroundTag":"invalid-url-format","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"}