{"record":{"id":"37b53e64dd2ea784","repo":"LykosAI/StabilityMatrix","slug":"package-path-is-null","errorCode":null,"errorMessage":"Package path is null","messagePattern":"Package path is null","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/Services/InferenceClientManager.cs","lineNumber":891,"sourceCode":"\n            await LoadSharedPropertiesAsync();\n        }\n        catch (Exception)\n        {\n            Client = null;\n            throw;\n        }\n        finally\n        {\n            IsConnecting = false;\n        }\n    }\n\n    private async Task MigrateLinksIfNeeded(PackagePair packagePair)\n    {\n        if (packagePair.InstalledPackage.FullPath is not { } packagePath)\n        {\n            throw new ArgumentException(\"Package path is null\", nameof(packagePair));\n        }\n\n        var inferenceDir = settingsManager.ImagesInferenceDirectory;\n        inferenceDir.Create();\n\n        // For locally installed packages only\n        // Delete ./output/Inference\n\n        var legacyInferenceLinkDir = new DirectoryPath(packagePair.InstalledPackage.FullPath).JoinDir(\n            \"output\",\n            \"Inference\"\n        );\n\n        if (legacyInferenceLinkDir.Exists)\n        {\n            logger.LogInformation(\"Deleting legacy inference link at {LegacyDir}\", legacyInferenceLinkDir);\n\n            if (legacyInferenceLinkDir.IsSymbolicLink)","sourceCodeStart":873,"sourceCodeEnd":909,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/Services/InferenceClientManager.cs#L873-L909","documentation":"MigrateLinksIfNeeded throws ArgumentException(\"Package path is null\", nameof(packagePair)) when the InstalledPackage.FullPath of the given PackagePair is null, so symlink migration for inference outputs cannot locate the package directory. It signals corrupt/incomplete package registration.","triggerScenarios":"Invoking inference (which triggers link migration) against a PackagePair whose InstalledPackage.FullPath was never set — e.g. a package record created before install completed or a partially imported package.","commonSituations":"Importing a package record from another machine/config without resolving its path; interrupted package installation leaving FullPath null; database record edited or migrated incorrectly; running inference on a package that was deleted but not unregistered.","solutions":["Reinstall or repair the package so InstalledPackage.FullPath is populated","Remove and re-add the package entry in Stability Matrix if its record is corrupt","Point the package at its actual install directory via package management UI","Only run inference against fully installed packages with valid paths"],"exampleFix":"// before\nawait inferenceManager.RunAsync(brokenPackagePair, prompt);\n// after\nif (brokenPackagePair.InstalledPackage.FullPath is null)\n{\n    throw new InvalidOperationException($\"Package '{brokenPackagePair.InstalledPackage.DisplayName}' has no install path; reinstall it first\");\n}\nawait inferenceManager.RunAsync(brokenPackagePair, prompt);","handlingStrategy":"validation","validationCode":"if (packagePair.InstalledPackage.FullPath is null)\n    throw new InvalidOperationException(\"Package not fully installed; reinstall before inference\");","typeGuard":"bool IsRunnable(PackagePair p) => p.InstalledPackage.FullPath is not null && Directory.Exists(p.InstalledPackage.FullPath);","tryCatchPattern":"try\n{\n    await inference.RunAsync(packagePair, prompt);\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Package path is null\"))\n{\n    // prompt user to reinstall/re-link the package\n}","preventionTips":["Only run inference on fully installed packages","Validate FullPath and directory existence before use","Clean up corrupt package records promptly"],"tags":["package","null-path","migration","argument"],"backgroundTag":"null-argument","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"}