{"record":{"id":"f7dde4c28f8cb972","repo":"microsoft/aspire","slug":"unknown-file-system-entry-type","errorCode":null,"errorMessage":"Unknown file system entry type","messagePattern":"Unknown file system entry type","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Dcp/Model/Container.cs","lineNumber":385,"sourceCode":"        return Destination == other.Destination\n            && DefaultOwner == other.DefaultOwner\n            && DefaultGroup == other.DefaultGroup\n            && Umask == other.Umask\n            && (Entries ?? Enumerable.Empty<ContainerFileSystemEntry>()).SequenceEqual(other.Entries ?? Enumerable.Empty<ContainerFileSystemEntry>());\n    }\n}\n\ninternal static class ContainerFileSystemItemExtensions\n{\n    [AspireExportIgnore(Reason = \"Internal conversion to the DCP ContainerFileSystemEntry model, which is not part of the ATS surface.\")]\n    public static ContainerFileSystemEntry ToContainerFileSystemEntry(this ContainerFileSystemItem item)\n    {\n        var type = item switch\n        {\n            ContainerFile => ContainerFileSystemEntryType.File,\n            ContainerOpenSSLCertificateFile => ContainerFileSystemEntryType.OpenSSL,\n            ContainerDirectory => ContainerFileSystemEntryType.Directory,\n            _ => throw new ArgumentException(\"Unknown file system entry type\")\n        };\n\n        var entry = new ContainerFileSystemEntry\n        {\n            Type = type,\n            Name = item.Name,\n            Owner = item.Owner,\n            Group = item.Group,\n            Mode = (int)item.Mode,\n        };\n\n        if (item is ContainerFileBase file)\n        {\n            entry.Source = file.SourcePath;\n            entry.Contents = file.Contents;\n            entry.ContinueOnError = file.ContinueOnError;\n\n            if (file.Contents is not null && file.SourcePath is not null)","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dcp/Model/Container.cs#L367-L403","documentation":"Thrown while converting a DCP container file-system entry (file, OpenSSL certificate, or directory) into its serialized ContainerFileSystemEntry form. The switch expects only the three known entry types; any other ContainerFileSystemEntry implementation triggers this ArgumentException, indicating an internal model invariant was violated.","triggerScenarios":"Calling ToContainerFileSystemEntry with a ContainerFileSystemEntry-derived type that is not ContainerFile, ContainerOpenSSLCertificateFile, or ContainerDirectory — effectively only possible by introducing a new DCP model type without updating this converter.","commonSituations":"Developers extending the DCP model with a new file-entry kind (e.g. a new certificate type) and forgetting to add the mapping case; not reachable through normal public Aspire APIs.","solutions":["Add a new case to the switch in ToContainerFileSystemEntry mapping the new entry type to a ContainerFileSystemEntryType.","If you did not intend a custom type, verify which object is being passed and use one of the supported entry classes (ContainerFile, ContainerOpenSSLCertificateFile, ContainerDirectory).","Update any associated DCP schema handling so the new entry type round-trips correctly."],"exampleFix":"// before\n_ => throw new ArgumentException(\"Unknown file system entry type\")\n// after\nContainerVolumeSecret => ContainerFileSystemEntryType.Secret,\n_ => throw new ArgumentException($\"Unknown file system entry type: {item.GetType().Name}\")","handlingStrategy":"type-guard","validationCode":"if (entry is not (ContainerFile or ContainerOpenSSLCertificateFile or ContainerDirectory))\n    throw new NotSupportedException($\"{entry.GetType().Name} is not a supported container file entry.\");","typeGuard":"static bool IsKnownEntryType(ContainerFileSystemEntry e) => e is ContainerFile or ContainerOpenSSLCertificateFile or ContainerDirectory;","tryCatchPattern":null,"preventionTips":["After adding a new DCP entry type, grep for ToContainerFileSystemEntry and update all switches.","Add a unit test exercising all entry-type conversions.","Avoid subclassing ContainerFileSystemEntry unless you plan to update the converters."],"tags":["containers","dcp","type-mismatch","internal-invariant"],"backgroundTag":"unsupported-enum-value","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}