XINCGer/Unity3DTraining · error · DescriptorValidationException
Missing name.
Error message
Missing name.
What it means
DescriptorPool.ValidateSymbolName throws DescriptorValidationException when a descriptor being registered (message, field, enum, etc.) has an empty Name. Every proto declaration must have a non-empty identifier name, so an empty name is rejected during descriptor construction.
Solutions
- Set the Name property on every proto descriptor before building (e.g. new DescriptorProto { Name = "MyMessage" }).
- Inspect the serialized FileDescriptorSet (protoc --descriptor_set_out) for declarations missing name fields.
- Regenerate descriptors with protoc rather than hand-crafting or editing serialized descriptor bytes.
- Add a pre-build check that iterates your FileDescriptorProto tree and asserts every declaration has a non-empty Name.
Example fix
// before
var msg = new DescriptorProto(); // Name unset -> "Missing name."
fileProto.MessageTypes.Add(msg);
// after
var msg = new DescriptorProto { Name = "MyMessage" };
fileProto.MessageTypes.Add(msg); Defensive patterns
Strategy: validation
Validate before calling
static void AssertNamesSet(FileDescriptorProto file)
{
foreach (var m in file.MessageTypes)
if (string.IsNullOrEmpty(m.Name)) throw new InvalidOperationException("Descriptor missing name");
} Type guard
bool HasName(IDescriptor d) => !string.IsNullOrEmpty(d.Name);
Try / catch
try
{
var fd = FileDescriptor.BuildFromByteString(bytes, dependencies);
}
catch (DescriptorValidationException ex) when (ex.Message == "Missing name.")
{
// reject/deserialize the descriptor set at source
} Prevention
- Always set Name in object initializers when constructing DescriptorProtos
- Regenerate descriptors with protoc instead of hand-editing serialized bytes
- Assert every declaration has a name before BuildFromByteString
When it happens
Trigger: Constructing descriptors (directly via DescriptorProtos or via FileDescriptor.BuildFromByteString) where a FieldDescriptorProto/DescriptorProto/EnumDescriptorProto has an unset or empty 'name' — typically a hand-constructed DescriptorProto or a corrupted/missing 'name' field in a serialized FileDescriptorSet.
Common situations: Programmatically building FileDescriptorProto/DescriptorProto and forgetting to set Name before building; a descriptor set produced by a broken codegen or tooling pipeline dropping name fields; manual edits to serialized descriptors.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- " " is not a valid identifier.
- Field numbers must be positive integers.
- " " is already defined (as something other than a package)…
- " " is already defined in file " ".
- Field number has already been used in " " by field " ".
AI-assisted analysis of XINCGer/Unity3DTraining@016f98412e (2026-09-12).
Data as JSON: /api/errors/e01085eba5c54789.
Report an issue: GitHub.
Appendix: source
Thrown at NetWorkAndResources/Socket_Protobuff/Assets/Plugins/Google.Protobuf/Reflection/DescriptorPool.cs:196
}
throw new DescriptorValidationException(descriptor, message);
}
descriptorsByName[fullName] = descriptor;
}
private static readonly Regex ValidationRegex = new Regex("^[_A-Za-z][_A-Za-z0-9]*$",
FrameworkPortability.CompiledRegexWhereAvailable);
/// <summary>
/// Verifies that the descriptor's name is valid (i.e. it contains
/// only letters, digits and underscores, and does not start with a digit).
/// </summary>
/// <param name="descriptor"></param>
private static void ValidateSymbolName(IDescriptor descriptor)
{
if (descriptor.Name == "")
{
throw new DescriptorValidationException(descriptor, "Missing name.");
}
if (!ValidationRegex.IsMatch(descriptor.Name))
{
throw new DescriptorValidationException(descriptor,
"\"" + descriptor.Name + "\" is not a valid identifier.");
}
}
/// <summary>
/// Returns the field with the given number in the given descriptor,
/// or null if it can't be found.
/// </summary>
internal FieldDescriptor FindFieldByNumber(MessageDescriptor messageDescriptor, int number)
{
FieldDescriptor ret;
fieldsByNumber.TryGetValue(new DescriptorIntPair(messageDescriptor, number), out ret);
return ret;
}View on GitHub (pinned to 016f98412e)