{"record":{"id":"7d4760e02b4dd266","repo":"stride3d/stride","slug":"could-not-find-dependency-0-when-processing-bundle-1","errorCode":null,"errorMessage":"Could not find dependency {0} when processing bundle {1}","messagePattern":"Could not find dependency (.+?) when processing bundle (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.AssetCompiler/BundlePacker.cs","lineNumber":142,"sourceCode":"                        resolvedDefaultBundle.AssetUrls.Add(asset.Key);\n                    }\n                }\n\n                // Pass4: Resolve dependencies\n                foreach (var bundle in resolvedBundles)\n                {\n                    // Every bundle depends implicitely on default bundle\n                    if (bundle.Key != \"default\")\n                    {\n                        bundle.Value.Dependencies.Add(resolvedBundles[\"default\"]);\n                    }\n\n                    // Add other explicit dependencies\n                    foreach (var dependencyName in bundle.Value.Source.Dependencies)\n                    {\n                        ResolvedBundle dependency;\n                        if (!resolvedBundles.TryGetValue(dependencyName, out dependency))\n                            throw new InvalidOperationException(string.Format(\"Could not find dependency {0} when processing bundle {1}\", dependencyName, bundle.Value.Name));\n\n                        bundle.Value.Dependencies.Add(dependency);\n                    }\n                }\n\n                logger.Info(\"Generate bundles: Assign assets to bundles...\");\n\n                // Pass5: Topological sort (a.k.a. build order)\n                // If there is a cyclic dependency, an exception will be thrown.\n                var sortedBundles = TopologicalSort(resolvedBundles.Values, assetBundle => assetBundle.Dependencies);\n\n                // Pass6: Find which ObjectId belongs to which bundle\n                foreach (var bundle in sortedBundles)\n                {\n                    // Add objects created by dependencies\n                    foreach (var dep in bundle.Dependencies)\n                    {\n                        // ObjectIds","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.AssetCompiler/BundlePacker.cs#L124-L160","documentation":"ObjectNode.Remove(item, itemIndex) requires a NodeIndex that actually resolves to a value; when itemIndex.TryGetValue returns false (an empty index) the method throws ArgumentException naming the itemIndex parameter. Removal from a collection node is always addressable by an index.","triggerScenarios":"Calling ObjectNode.Remove with NodeIndex.Empty or an otherwise unresolvable index, e.g. Remove(item, NodeIndex.Empty) or an index built without a valid index value.","commonSituations":"Copy-pasted Add-style code where an empty index is acceptable, reused for Remove; UI code that lost track of the selected item's index and passes a default NodeIndex.","solutions":["Pass the real NodeIndex of the item being removed (as obtained from enumeration or the selection).","Validate with itemIndex.TryGetValue(out _) before calling Remove.","If the item's index is unknown, look it up via the collection descriptor before removing."],"exampleFix":"// before\nnode.Remove(item, NodeIndex.Empty);\n// after\nif (!itemIndex.TryGetValue(out _)) throw new InvalidOperationException(\"Remove requires a valid item index\");\nnode.Remove(item, itemIndex);","handlingStrategy":"validation","validationCode":"if (!itemIndex.TryGetValue(out _)) throw new InvalidOperationException(\"Remove requires a resolvable NodeIndex\");\nnode.Remove(item, itemIndex);","typeGuard":"bool HasIndex(NodeIndex idx) => idx.TryGetValue(out _);","tryCatchPattern":"try { node.Remove(item, itemIndex); }\ncatch (ArgumentException ex) when (ex.ParamName == nameof(itemIndex)) { /* re-acquire the correct index for the item */ }","preventionTips":["Track each item's NodeIndex when enumerating","Never pass NodeIndex.Empty to Remove","Validate indices with TryGetValue before node mutations"],"tags":["argument","nodeindex","quantum"],"backgroundTag":"missing-required-argument","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}