{"record":{"id":"f0f0049d1b9a4733","repo":"stride3d/stride","slug":"unable-to-create-directory-0","errorCode":null,"errorMessage":"Unable to create directory [{0}]","messagePattern":"Unable to create directory \\[(.+?)\\]","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.IO/FileSystemProvider.cs","lineNumber":83,"sourceCode":"    }\n\n    public override bool DirectoryExists(string url)\n    {\n        var path = ConvertUrlToFullPath(url);\n        return Directory.Exists(path);\n    }\n\n    /// <inheritdoc/>\n    public override void CreateDirectory(string url)\n    {\n        var path = ConvertUrlToFullPath(url);\n        try\n        {\n            Directory.CreateDirectory(path);\n        }\n        catch (Exception ex)\n        {\n            throw new InvalidOperationException(\"Unable to create directory [{0}]\".ToFormat(path), ex);\n        }\n    }\n\n    /// <inheritdoc/>\n    public override bool FileExists(string url)\n    {\n        return File.Exists(ConvertUrlToFullPath(url));\n    }\n\n    public override long FileSize(string url)\n    {\n        var fileInfo = new FileInfo(ConvertUrlToFullPath(url));\n        return fileInfo.Length;\n    }\n\n    /// <inheritdoc/>\n    public override void FileDelete(string url)\n    {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.IO/FileSystemProvider.cs#L65-L101","documentation":"CreateDirectory wraps Directory.CreateDirectory and converts any OS failure (permissions, invalid characters, IO errors) into an InvalidOperationException with the offending path, keeping the original exception as InnerException.","triggerScenarios":"Calling provider.CreateDirectory(url) where the underlying path cannot be created: no write permission on parent, path is actually an existing file, illegal characters, disk full, or network share unavailable.","commonSituations":"Creating output folders on read-only deployments, sandboxed environments without write access, or when the path collides with an existing file.","solutions":["Check/fix write permissions on the parent directory","Ensure the path does not point to an existing file; delete or rename it","Inspect the InnerException for the exact OS error","Verify the URL resolves to a valid local path (base path set correctly)"],"exampleFix":"// before\nprovider.CreateDirectory(outputUrl);\n// after\nif (!provider.DirectoryExists(outputUrl))\n{\n    try { provider.CreateDirectory(outputUrl); }\n    catch (InvalidOperationException ex) { logger.Error($\"Cannot create {outputUrl}: {ex.InnerException?.Message}\"); throw; }\n}","handlingStrategy":"try-catch","validationCode":"if (File.Exists(localPath)) throw new IOException($\"{localPath} exists and is a file\");\n// ensure parent is writable beforehand\nnew FileInfo(localPath).Directory?.Refresh();","typeGuard":null,"tryCatchPattern":"try { provider.CreateDirectory(url); }\ncatch (InvalidOperationException ex) { Log(ex.InnerException ?? ex); throw; }","preventionTips":["Check existing files vs directories before creating","Verify deployment accounts have write access to target folders","Never swallow the InnerException — it holds the OS error code"],"tags":["io","directory","permissions"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}