{"record":{"id":"9a80620cf8e95d8b","repo":"abpframework/abp","slug":"specified-directory-does-not-exist-9a8062","errorCode":null,"errorMessage":"Specified directory does not exist.","messagePattern":"Specified directory does not exist\\.","errorType":"exception","errorClass":"CliUsageException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToLocalCommand.cs","lineNumber":32,"sourceCode":"public class SwitchToLocal : IConsoleCommand, ITransientDependency\n{\n    private readonly LocalReferenceConverter _localReferenceConverter;\n    public const string Name = \"switch-to-local\";\n    \n    public ILogger<SwitchToLocal> Logger { get; set; }\n\n    public SwitchToLocal(LocalReferenceConverter localReferenceConverter)\n    {\n        _localReferenceConverter = localReferenceConverter;\n    }\n    \n    public async Task ExecuteAsync(CommandLineArgs commandLineArgs)\n    {\n        var workingDirectory = GetWorkingDirectory(commandLineArgs) ?? Directory.GetCurrentDirectory();\n\n        if (!Directory.Exists(workingDirectory))\n        {\n            throw new CliUsageException(\n                \"Specified directory does not exist.\" +\n                Environment.NewLine + Environment.NewLine +\n                GetUsageInfo()\n            );\n        }\n\n        await _localReferenceConverter.ConvertAsync(workingDirectory, GetPaths(commandLineArgs));\n    }\n\n    private List<string> GetPaths(CommandLineArgs commandLineArgs)\n    {\n        var paths = commandLineArgs.Options.GetOrNull(\n            Options.LocalPaths.Short,\n            Options.LocalPaths.Long\n        );\n\n        if (paths == null)\n        {","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SwitchToLocalCommand.cs#L14-L50","documentation":"Thrown by SwitchToLocal.ExecuteAsync when the resolved working directory doesn't exist on the filesystem. The working directory comes from the -s/--solution option (or current directory if not specified). If the option value ends in .sln/.slnx/.csproj, GetWorkingDirectory extracts the parent directory via Path.GetDirectoryName. Directory.Exists then returns false for this path.","triggerScenarios":"Running 'abp switch-to-local -s <nonexistent-path>' or running from a deleted/unmounted directory. Also triggered when --solution points to a .sln file whose parent directory doesn't exist.","commonSituations":"Typo in the path, pointing to a network share that's disconnected, path copied from a different machine, case-sensitivity mismatch on Linux/macOS, relative path resolving from the wrong cwd.","solutions":["Verify the directory exists: 'ls <path>' on Linux/Mac or 'dir <path>' on Windows","Use an absolute path starting from the filesystem root","If pointing to a .sln file, ensure the file exists and the parent directory is valid","Check for case-sensitivity issues on Linux/macOS"],"exampleFix":"// before\nabp switch-to-local -s /wrond/path --paths /abp\n\n// after\nabp switch-to-local -s /correct/path --paths /abp","handlingStrategy":"validation","validationCode":"// Validate directory exists before running switch-to-local\nvar workingDir = GetWorkingDirectory(commandLineArgs) ?? Directory.GetCurrentDirectory();\nif (!Directory.Exists(workingDir))\n{\n    Console.Error.WriteLine($\"Error: Directory does not exist: {workingDir}\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await switchToLocal.ExecuteAsync(commandLineArgs);\n}\ncatch (CliUsageException ex) when (ex.Message.Contains(\"Specified directory does not exist\"))\n{\n    Console.Error.WriteLine($\"Directory not found. Verify the path with 'ls' and use absolute paths.\");\n}","preventionTips":["Always use absolute paths for the --solution option","Verify directory existence before running the command","Watch for case-sensitivity on Linux/macOS","Ensure network drives are mounted before referencing them"],"tags":["switch-to-local","cli","directory-not-found","path-validation"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}