{"record":{"id":"55661a01f2a03890","repo":"microsoft/aspire","slug":"unexpected-input-type-inputtype","errorCode":null,"errorMessage":"Unexpected input type: {inputType}","messagePattern":"Unexpected input type: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting/Dashboard/DashboardService.cs","lineNumber":271,"sourceCode":"        if (!string.IsNullOrEmpty(input.FileFilter))\n        {\n            dto.FileFilter = input.FileFilter;\n        }\n        dto.ValidationErrors.AddRange(input.ValidationErrors);\n        return dto;\n    }\n\n    internal static Aspire.DashboardService.Proto.V1.InputType MapInputType(Aspire.Hosting.InputType inputType)\n    {\n        return inputType switch\n        {\n            Aspire.Hosting.InputType.Text => Aspire.DashboardService.Proto.V1.InputType.Text,\n            Aspire.Hosting.InputType.SecretText => Aspire.DashboardService.Proto.V1.InputType.SecretText,\n            Aspire.Hosting.InputType.Choice => Aspire.DashboardService.Proto.V1.InputType.Choice,\n            Aspire.Hosting.InputType.Boolean => Aspire.DashboardService.Proto.V1.InputType.Boolean,\n            Aspire.Hosting.InputType.Number => Aspire.DashboardService.Proto.V1.InputType.Number,\n            Aspire.Hosting.InputType.File => Aspire.DashboardService.Proto.V1.InputType.File,\n            _ => throw new InvalidOperationException($\"Unexpected input type: {inputType}\"),\n        };\n    }\n\n    public static Aspire.Hosting.InputType MapInputType(Aspire.DashboardService.Proto.V1.InputType inputType)\n    {\n        return inputType switch\n        {\n            Aspire.DashboardService.Proto.V1.InputType.Text => InputType.Text,\n            Aspire.DashboardService.Proto.V1.InputType.SecretText => InputType.SecretText,\n            Aspire.DashboardService.Proto.V1.InputType.Choice => InputType.Choice,\n            Aspire.DashboardService.Proto.V1.InputType.Boolean => InputType.Boolean,\n            Aspire.DashboardService.Proto.V1.InputType.Number => InputType.Number,\n            Aspire.DashboardService.Proto.V1.InputType.File => InputType.File,\n            _ => throw new InvalidOperationException($\"Unexpected input type: {inputType}\"),\n        };\n    }\n\n    public override async Task WatchResources(","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting/Dashboard/DashboardService.cs#L253-L289","documentation":"MapInputType converts the host-side InputType enum to the dashboard's protobuf InputType enum for interactive resource inputs. Hitting the default arm means an InputType value exists in the hosting enum that this mapper doesn't know — usually a version mismatch between the AppHost package and the dashboard proto contract, or a newly added enum member.","triggerScenarios":"An interaction is created with an InputType value (e.g. added in a newer Aspire version) that the deployed/older dashboard proto mapping lacks; passing a raw or cast numeric value into the enum that isn't a defined member.","commonSituations":"Mixed-version Aspire packages in one solution (hosting package newer than dashboard transport contracts); custom code enumerating/adding InputType values; casting ints to InputType without validation.","solutions":["Align Aspire.Hosting and dashboard-related package versions across the solution (update all to the same Aspire version)","If you cast ints to InputType, validate with Enum.IsDefined before use","If you hit this on a stock setup, report it — it's an internal invariant violation between host and dashboard"],"exampleFix":"// before\nvar type = (InputType)42;\ninteraction.InputType = type;\n// after\nif (!Enum.IsDefined(typeof(InputType), value)) throw new ArgumentOutOfRangeException(nameof(value));\ninteraction.InputType = (InputType)value;","handlingStrategy":"type-guard","validationCode":"if (!Enum.IsDefined(typeof(InputType), inputType))\n    throw new InvalidEnumArgumentException(nameof(inputType), (int)inputType, typeof(InputType));","typeGuard":"static bool IsKnownInputType(InputType t) => t is InputType.Text or InputType.SecretText or InputType.Choice or InputType.Boolean or InputType.Number or InputType.File;","tryCatchPattern":"try { /* create interaction / map input type */ }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Unexpected input type\")) { /* check package version alignment */ }","preventionTips":["Keep all Aspire.* packages on the same version in the solution","Never cast raw ints to InputType without Enum.IsDefined","After upgrading Aspire, rebuild everything so host and dashboard contracts match"],"tags":["dashboard","enum","rpc"],"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-21T09:17:21.228Z"}