{"record":{"id":"72ebad0e079cdc36","repo":"apple/pkl","slug":"invalidsettingsfile","errorCode":"invalidSettingsFile","errorMessage":"invalidSettingsFile","messagePattern":"invalidSettingsFile","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/settings/PklSettings.java","lineNumber":113,"sourceCode":"                SecurityManagers.standard(\n                    ALLOWED_MODULES, ALLOWED_RESOURCES, SecurityManagers.defaultTrustLevels, null))\n            .setStackFrameTransformer(StackFrameTransformers.defaultTransformer)\n            .addModuleKeyFactory(ModuleKeyFactories.standardLibrary)\n            .addModuleKeyFactory(ModuleKeyFactories.file)\n            .addResourceReader(ResourceReaders.environmentVariable())\n            .addEnvironmentVariables(System.getenv())\n            .build()) {\n      var module = evaluator.evaluateOutputValueAs(moduleSource, PClassInfo.Settings);\n      return parseSettings(module, moduleSource);\n    }\n  }\n\n  private static PklSettings parseSettings(PObject module, ModuleSource location)\n      throws VmEvalException {\n\n    if (!(module.getPropertyOrNull(\"editor\") instanceof PObject pObject)\n        || !(pObject.getPropertyOrNull(\"urlScheme\") instanceof String str)) {\n      throw new VmExceptionBuilder().evalError(\"invalidSettingsFile\", location.getUri()).build();\n    }\n    var editor = new Editor(str);\n    var httpSettings = PklEvaluatorSettings.Http.parse((Value) module.getProperty(\"http\"));\n    return new PklSettings(editor, httpSettings);\n  }\n\n  /**\n   * Returns the editor for viewing and editing Pkl files.\n   *\n   * <p>This method is deprecated, use {@link #editor()} instead.\n   */\n  @Deprecated(forRemoval = true)\n  public Editor getEditor() {\n    return editor;\n  }\n\n  /** An editor for viewing and editing Pkl files. */\n  public record Editor(String urlScheme) {","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/settings/PklSettings.java#L95-L131","documentation":"PklSettings files (`pklSettings.pkl`) must define an `editor` object containing a non-null string `urlScheme` property. When parseSettings loads the settings module and either `editor` is missing/not an object or `editor.urlScheme` is not a String, it rejects the whole settings file as invalid. This guards against malformed or outdated pklSettings.pkl files that the CLI cannot interpret.","triggerScenarios":"Loading a pklSettings.pkl via load() where the module has no `editor` property, `editor` is not a PObject, `editor.urlScheme` is absent, or `editor.urlScheme` is not a String.","commonSituations":"Hand-edited or generated pklSettings.pkl missing the editor block; copying an old settings file from a Pkl version with a different schema; a typo like `urlScheem = \"...\"`; setting urlScheme to a non-string (e.g. null or a number).","solutions":["Add the required editor block: `editor { urlScheme = \"vscode\" }` (or your editor's scheme) to pklSettings.pkl.","Check spelling/casing of `editor` and `urlScheme` properties.","Ensure urlScheme is a String literal, not null, a number, or an expression evaluating to a non-string.","Regenerate or update pklSettings.pkl from the current Pkl version's documented template."],"exampleFix":"// before (pklSettings.pkl)\nhttp {\n  proxies = new {}\n}\n\n// after\neditor {\n  urlScheme = \"vscode\"\n}\nhttp {\n  proxies = new {}\n}","handlingStrategy":"validation","validationCode":"// pklSettings.pkl self-check\nif (editor?.urlScheme is String == false) {\n  throw(\"pklSettings.pkl must define editor { urlScheme = <String> }\")\n}","typeGuard":"function isValidSettings(m) { return m?.editor instanceof Object && typeof m.editor?.urlScheme === 'string'; }","tryCatchPattern":"try { loadSettings(path) } catch (e: VmEvalException) { if (e.message.contains('invalidSettingsFile')) regenerateDefaults(path) else throw e }","preventionTips":["Keep pklSettings.pkl under version control with the editor block intact","Validate settings files after generating them programmatically","Check the Pkl release notes when upgrading for settings schema changes"],"tags":["pkl","configuration","settings-file","validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}