{"record":{"id":"57097bb10f13286c","repo":"stride3d/stride","slug":"the-guid-must-be-different-from-guid-empty","errorCode":null,"errorMessage":"The guid must be different from Guid.Empty.","messagePattern":"The guid must be different from Guid\\.Empty\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Quantum/GraphNodeBase.cs","lineNumber":19,"sourceCode":"// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)\n// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.\n\nusing System.Collections;\nusing Stride.Core.Reflection;\nusing Stride.Core.TypeConverters;\n\nnamespace Stride.Core.Quantum;\n\n/// <summary>\n/// A base abstract implementation of the <see cref=\"IGraphNode\"/> interface.\n/// </summary>\npublic abstract class GraphNodeBase : IInitializingGraphNode\n{\n    protected readonly NodeContainer NodeContainer;\n\n    protected GraphNodeBase(NodeContainer nodeContainer, Guid guid, ITypeDescriptor descriptor)\n    {\n        if (guid == Guid.Empty) throw new ArgumentException(\"The guid must be different from Guid.Empty.\", nameof(guid));\n        NodeContainer = nodeContainer;\n        Guid = guid;\n        Descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor));\n    }\n\n    /// <inheritdoc/>\n    public Type Type => Descriptor.Type;\n\n    /// <inheritdoc/>\n    public ITypeDescriptor Descriptor { get; }\n\n    /// <inheritdoc/>\n    public abstract bool IsReference { get; }\n\n    /// <inheritdoc/>\n    public Guid Guid { get; }\n\n    /// <inheritdoc/>","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Quantum/GraphNodeBase.cs#L1-L37","documentation":"GraphNodeBase's constructor throws ArgumentException when given Guid.Empty, because every graph node needs a unique identifier for lookup and path resolution within the NodeContainer. A Guid.Empty node would be ambiguous and break node indexing.","triggerScenarios":"Creating a GraphNode (ObjectNode, BoxedNode, MemberNode) with Guid.Empty — typically NodeFactory.CreateObjectNode/CreateBoxedNode invoked with an empty guid from a builder or custom factory.","commonSituations":"Generating identifiers via a source that returned Guid.Empty (e.g. IdProvider misconfigured, default(Guid) used); manually constructing nodes in tests without assigning a guid.","solutions":["Generate a real guid with Guid.NewGuid() (or the container's IGuidGenerator) before constructing the node","Fix the IGuidGenerator/NodeFactory wiring so it never yields Guid.Empty","Catch ArgumentException at node creation to report missing guid generation","Use Debug.Assert(guid != Guid.Empty) early in custom factory code"],"exampleFix":"// before\nvar node = NodeFactory.CreateObjectNode(container, Guid.Empty, obj, descriptor);\n// after\nvar node = NodeFactory.CreateObjectNode(container, Guid.NewGuid(), obj, descriptor);","handlingStrategy":"validation","validationCode":"if (guid == Guid.Empty) throw new ArgumentException(\"Node guid must be generated\", nameof(guid));","typeGuard":null,"tryCatchPattern":"try { var node = factory.CreateObjectNode(container, guid, obj, desc); } catch (ArgumentException ex) when (ex.ParamName == \"guid\") { logger.LogError(ex, \"Guid.Empty passed to node factory\"); }","preventionTips":["Always generate ids with Guid.NewGuid() or the container's IGuidGenerator","Never default(Guid) in node-creation code paths","Assert non-empty guids in unit tests for custom factories"],"tags":["guid","argument","quantum"],"backgroundTag":"invalid-argument-value","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"}