{"record":{"id":"d0b93c9a286134c4","repo":"denoland/deno","slug":"unable-to-construct-url-from-the-path-of-cwd-d0b93c","errorCode":null,"errorMessage":"Unable to construct URL from the path of cwd: {}","messagePattern":"Unable to construct URL from the path of cwd: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli/tools/repl/session.rs","lineNumber":354,"sourceCode":"            .aux_data\n            .get(\"isDefault\")\n            .unwrap()\n            .as_bool()\n            .unwrap()\n        );\n        context_id = execution_context_created.context.id;\n        break;\n      }\n    }\n    assert_ne!(context_id, 0);\n\n    let referrer =\n      deno_core::resolve_path(\"./$deno$repl.mts\", cli_options.initial_cwd())\n        .unwrap();\n\n    let cwd_url =\n      Url::from_directory_path(cli_options.initial_cwd()).map_err(|_| {\n        anyhow!(\n          \"Unable to construct URL from the path of cwd: {}\",\n          cli_options.initial_cwd().to_string_lossy(),\n        )\n      })?;\n    let transpile_options = &compiler_options_resolver\n      .for_specifier(&cwd_url)\n      .transpile_options()?\n      .transpile;\n    let mut repl_session = ReplSession {\n      internal_object_id: None,\n      npm_installer,\n      resolver,\n      worker,\n      session,\n      state,\n      context_id,\n      referrer,\n      notifications: Arc::new(Mutex::new(notification_rx)),","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/repl/session.rs#L336-L372","documentation":"On REPL startup Deno converts the initial working directory to a `file://` directory URL (`Url::from_directory_path`) to resolve compiler options for the session. The conversion fails for paths the URL standard cannot represent — relative paths and certain Windows forms — so REPL startup aborts with this message including the offending path. In practice the OS cwd is absolute, so this signals an unusual launch environment.","triggerScenarios":"Starting `deno` (REPL) from a parent process that passes a relative or malformed cwd, a directory that was deleted/renamed out from under the shell, or exotic Windows paths (UNC edge cases, invalid characters).","commonSituations":"Editors or terminal wrappers spawning deno with a stale cwd after the project directory moved; scripts cd'd into a now-removed directory; test harnesses spawning processes with odd working directories.","solutions":["Change into an existing absolute directory (cd ~) and start the REPL again","If a wrapper spawns deno, make sure it passes a valid, existing absolute working directory","Recreate or fix the directory the shell still points at"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# guard for wrappers/terminals spawning the deno REPL\ncase \"$PWD\" in\n  /*) [ -d \"$PWD\" ] || { echo \"cwd no longer exists: $PWD\" >&2; exit 1; } ;;\n  *) echo \"cwd is not an absolute path: $PWD\" >&2; exit 1 ;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Spawn deno with an explicit, existing absolute cwd","Re-enter the project directory after moving or renaming it instead of relying on a stale shell cwd","In editor integrations, resolve the project path fresh at launch time"],"tags":["repl","path","environment","windows"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}