{"record":{"id":"cbfeaf24bdb5b381","repo":"LykosAI/StabilityMatrix","slug":"inputimagesdir-is-null","errorCode":null,"errorMessage":"InputImagesDir is null","messagePattern":"InputImagesDir is null","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/Services/InferenceClientManager.cs","lineNumber":803,"sourceCode":"\n        // Encode mask to PNG\n        using var data = maskImage.Encode(SkiaSharp.SKEncodedImageFormat.Png, 100);\n        using var stream = new MemoryStream();\n        data.SaveTo(stream);\n        stream.Position = 0;\n\n        await Client.UploadImageAsync(stream, fileName, cancellationToken);\n    }\n\n    /// <inheritdoc />\n    public async Task CopyImageToInputAsync(FilePath imageFile, CancellationToken cancellationToken = default)\n    {\n        if (!IsConnected)\n            return;\n\n        if (Client.InputImagesDir is not { } inputImagesDir)\n        {\n            throw new InvalidOperationException(\"InputImagesDir is null\");\n        }\n\n        var inferenceInputs = inputImagesDir.JoinDir(\"Inference\");\n        inferenceInputs.Create();\n\n        var destination = inferenceInputs.JoinFile(imageFile.Name);\n\n        // Read to SKImage then write to file, to prevent errors from metadata\n        await Task.Run(\n            () =>\n            {\n                using var imageStream = imageFile.Info.OpenRead();\n                using var image = SKImage.FromEncodedData(imageStream);\n                using var destinationStream = destination.Info.OpenWrite();\n                image.Encode(SKEncodedImageFormat.Png, 100).SaveTo(destinationStream);\n            },\n            cancellationToken\n        );","sourceCodeStart":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/Services/InferenceClientManager.cs#L785-L821","documentation":"UploadInputImageAsync throws this when the connected client reports no InputImagesDir (the ComfyUI server did not advertise an input images directory). The method early-returns if not connected, so this error only fires on a connected client whose input directory mapping is missing — an unexpected server state.","triggerScenarios":"Calling UploadInputImageAsync on a client whose SharedModel/ComfyApi connection lacks InputImagesDir — e.g. server version without the expected folder mapping, or shared-model metadata not fully loaded.","commonSituations":"Connecting to an unusual or partially initialized ComfyUI deployment; server started with a nonstandard input directory config; using an older/newer backend whose API surface differs from what the manager expects.","solutions":["Ensure the ComfyUI server exposes its input directory (standard installation/layout)","Fully connect and load shared model/paths info (ConnectAsync + LoadSharedPropertiesAsync) before uploading","Check the server's folder configuration for a missing input directory mapping","Update Stability Matrix or the backend package if versions mismatch"],"exampleFix":"// before\nawait clientManager.UploadInputImageAsync(image, \"input.png\");\n// after\nawait clientManager.ConnectAsync();\nawait clientManager.LoadSharedPropertiesAsync();\nif (clientManager.Client?.InputImagesDir is null)\n    throw new InvalidOperationException(\"Server did not report an input images directory\");\nawait clientManager.UploadInputImageAsync(image, \"input.png\");","handlingStrategy":"validation","validationCode":"if (clientManager.Client?.InputImagesDir is null)\n    throw new InvalidOperationException(\"Backend did not expose an input images directory\");","typeGuard":"bool HasInputDir(InferenceClientManager m) => m.Client?.InputImagesDir is not null;","tryCatchPattern":"try\n{\n    await clientManager.UploadInputImageAsync(image, name);\n}\ncatch (InvalidOperationException ex) when (ex.Message == \"InputImagesDir is null\")\n{\n    // surface a setup error: backend folder config incomplete\n}","preventionTips":["Complete full connection setup before uploading","Use standard ComfyUI folder layouts","Update backend/Stability Matrix to compatible versions"],"tags":["upload","inference","server-state","missing-path"],"backgroundTag":"missing-required-config-field","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}