{"record":{"id":"f5a1ee4d486979b1","repo":"Unity-Technologies/UnityCsReference","slug":"invalid-signature-bitconverter-tostring-signatur","errorCode":null,"errorMessage":"Invalid signature ({BitConverter.ToString(signatureHashSpan.ToArray())}) found (Expected: {BitConverter.ToString(Signature)}).\nDependencyGraph file is either corrupted or from a previous version of Unity. If you observe inexplicable runtime/compilation errors, please delete `Library/` folder and reopen the project.","messagePattern":"Invalid signature \\((.+?)\\) found \\(Expected: (.+?)\\)\\.\nDependencyGraph file is either corrupted or from a previous version of Unity\\. If you observe inexplicable runtime/compilation errors, please delete `Library/` folder and reopen the project\\.","errorType":"exception","errorClass":"InvalidDataException","httpStatus":null,"severity":"critical","filePath":"Editor/Mono/Scripting/APIUpdater/AssemblyDependencyGraph.cs","lineNumber":291,"sourceCode":"            stream.Position = payloadOffset; // Position the stream in the first byte of the serialized data (i.e, skip *hash length* and *hash*\n            var hash = hasher.ComputeHash(stream);\n            stream.Position = hashOffset; // position the stream past the *hash length* (i.e, *hash-first byte*)\n            stream.Write(hash);\n\n            stream.Position = endOfStream;\n        }\n\n        public static AssemblyDependencyGraph LoadFrom(Stream stream)\n        {\n            ValidateMinimumLength(stream);\n\n            Span<byte> signatureHashSpan = stackalloc byte[Signature.Length];\n            var read = stream.Read(signatureHashSpan);\n            Debug.Assert(read == signatureHashSpan.Length); // ValidateMinimumLength() guarantees there's enough data to fulfill the request.\n\n            if (!signatureHashSpan.SequenceEqual(Signature))\n            {\n                throw new InvalidDataException($\"\"\"\n                                                Invalid signature ({BitConverter.ToString(signatureHashSpan.ToArray())}) found (Expected: {BitConverter.ToString(Signature)}).{Environment.NewLine}\n                                                DependencyGraph file is either corrupted or from a previous version of Unity. If you observe inexplicable runtime/compilation errors, please delete `Library/` folder and reopen the project.\n                                                \"\"\");\n            }\n\n            int version = stream.ReadByte();\n            if (version != Version)\n            {\n                throw new InvalidDataException($\"\"\"\n                                                Unsupported DependencyGraph version ({version}).{Environment.NewLine}\n                                                DependencyGraph file is either corrupted or from a newer version of Unity.\n                                                \"\"\");\n            }\n\n            Span<byte> hashLengthSpan = stackalloc byte[sizeof(long)];\n            read = stream.Read(hashLengthSpan);\n            if (read != hashLengthSpan.Length)\n                throw new InvalidDataException($\"Read only {read} out of {hashLengthSpan.Length} bytes for hash length.\");","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/Scripting/APIUpdater/AssemblyDependencyGraph.cs#L273-L309","documentation":"Thrown by AssemblyDependencyGraph.LoadFrom as InvalidDataException when the file's signature bytes do not match the expected Signature constant. The DependencyGraph binary file starts with a magic signature to identify its format; a mismatch indicates the file is corrupted, truncated, or was written by a different (incompatible) Unity version. The error message includes both the found and expected signatures and advises deleting the Library/ folder.","triggerScenarios":"Opening a project whose Library/ folder contains a DependencyGraph file from an older or newer Unity version. Manually editing or partially overwriting the file. Disk corruption affecting the Library/ folder.","commonSituations":"Switching Unity versions on the same project without clearing Library/. Pulling a project from version control that accidentally included Library/. Interrupted Unity process leaving a half-written file.","solutions":["Delete the Library/ folder and reopen the project in Unity to force regeneration.","Ensure all team members and CI use the same Unity version.","Add Library/ to .gitignore to avoid stale files from version control."],"exampleFix":"// No code fix; this is an environment issue.\n// Terminal fix:\n//   rm -rf Library/\n// Then reopen the project in Unity.","handlingStrategy":"fallback","validationCode":"// No runtime validation possible; the file is already written incorrectly.\n// Prevent by excluding Library/ from version control and using consistent Unity versions.","typeGuard":null,"tryCatchPattern":"try\n{\n    AssemblyDependencyGraph.LoadFrom(stream);\n}\ncatch (InvalidDataException)\n{\n    // Delete Library/ and regenerate.\n}","preventionTips":["Delete Library/ when switching Unity versions.","Keep Library/ in .gitignore.","Standardize Unity version across team and CI."],"tags":["unity","dependency-graph","editor","corruption","version-mismatch"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}