{"record":{"id":"ee7391008ed9ace7","repo":"denoland/deno","slug":"scope-was-not-a-directory-path","errorCode":null,"errorMessage":"Scope '{}' was not a directory path.","messagePattern":"Scope '(.+?)' was not a directory path\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/lsp/config.rs","lineNumber":1487,"sourceCode":"            None => {\n              deno_config::workspace::WorkspaceDiscoverStart::Paths(&paths)\n            }\n          },\n          &WorkspaceDiscoverOptions {\n            additional_config_file_names: &[],\n            deno_json_cache: Some(deno_json_cache),\n            pkg_json_cache: Some(pkg_json_cache),\n            workspace_cache: Some(workspace_cache),\n            discover_pkg_json: !has_flag_env_var(\n              &CliSys::default(),\n              \"DENO_NO_PACKAGE_JSON\",\n            ),\n            maybe_vendor_override: None,\n          },\n        )\n        .map_err(AnyError::from)\n      }\n      Err(()) => Err(anyhow!(\"Scope '{}' was not a directory path.\", scope)),\n    };\n    match discover_result {\n      Ok(member_dir) => {\n        Self::load_inner(\n          member_dir,\n          scope,\n          settings,\n          Some(file_fetcher),\n          Some(http_client_provider),\n          ws_data_cache,\n        )\n        .await\n      }\n      Err(err) => {\n        lsp_warn!(\"  Couldn't open workspace \\\"{}\\\": {}\", scope.as_str(), err);\n        let member_dir =\n          WorkspaceDirectory::empty(WorkspaceDirectoryEmptyOptions {\n            root_dir: scope.clone(),","sourceCodeStart":1469,"sourceCodeEnd":1505,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/lsp/config.rs#L1469-L1505","documentation":"In the Deno LSP (cli/lsp/config.rs:1487), every workspace scope key from deno.scopes / workspace configuration must convert to a local directory path via Url::to_file_path(). When that conversion fails — the URL is not a file:// URL or is structurally not a directory-path URL — ConfigData::load returns \"Scope '{}' was not a directory path.\" and configuration for that scope is rejected.","triggerScenarios":"Putting a non-file scope key in settings, e.g. \"deno\": { \"scopes\": { \"https://example.com/mod\": {} } }; a VS Code multi-root folder backed by a remote/untitled scheme; a file URL that omits the trailing slash and encodes a file rather than a directory; malformed URL keys.","commonSituations":"Hand-editing .vscode/settings.json scopes after the auto-generated entries; SSH/remote or live-share workspace folders whose scheme isn't file:; scope keys written as plain paths (/home/me/proj) instead of file:///home/me/proj/.","solutions":["Use absolute file:// URLs that end with a slash for directories: \"file:///home/me/project/\"","Fix or remove non-file scope keys (https:, untitled:, plain paths) from deno.scopes and deno.testing scopes in VS Code settings","Reopen the folder as a local (file-scheme) workspace folder instead of a remote scheme so the LSP can map it"],"exampleFix":"// before (.vscode/settings.json)\n\"deno\": { \"scopes\": { \"file:///home/me/proj/src\": { \"unstable\": true } } }\n\n// after\n\"deno\": { \"scopes\": { \"file:///home/me/proj/src/\": { \"unstable\": true } } }","handlingStrategy":"validation","validationCode":"// Validate editor settings before the LSP reads them\nfunction validateScopes(scopes) {\n  for (const key of Object.keys(scopes)) {\n    const u = new URL(key);\n    if (u.protocol !== \"file:\" || !key.endsWith(\"/\")) {\n      console.error(`bad scope '${key}': must be a file:// URL ending with '/'`);\n      return false;\n    }\n  }\n  return true;\n}","typeGuard":"function isDirectoryFileUrl(s: string): s is `file:///${string}/` {\n  try {\n    const u = new URL(s);\n    return u.protocol === \"file:\" && s.endsWith(\"/\");\n  } catch {\n    return false;\n  }\n}","tryCatchPattern":null,"preventionTips":["Let the editor/Deno extension generate scope keys (they are correct file:// URLs with trailing slash)","When hand-editing deno.scopes, copy an existing working entry and change only the path","Avoid remote-scheme workspace folders with the Deno LSP; reopen the folder locally"],"tags":["lsp","configuration","scopes","url"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}