{"record":{"id":"1834b320eca228a7","repo":"microsoft/semantic-kernel","slug":"the-value-type-value-primitivetype-of-entityd","errorCode":null,"errorMessage":"The value type '{value.PrimitiveType}' of {entityDescription} '{entityName}' is not supported.","messagePattern":"The value type '(.+?)' of (.+?) '(.+?)' is not supported\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs","lineNumber":595,"sourceCode":"        if (valueMetadata is not IOpenApiPrimitive value)\n        {\n            return null;\n        }\n\n        return value.PrimitiveType switch\n        {\n            PrimitiveType.Integer => ((OpenApiInteger)value).Value,\n            PrimitiveType.Long => ((OpenApiLong)value).Value,\n            PrimitiveType.Float => ((OpenApiFloat)value).Value,\n            PrimitiveType.Double => ((OpenApiDouble)value).Value,\n            PrimitiveType.String => ((OpenApiString)value).Value,\n            PrimitiveType.Byte => ((OpenApiByte)value).Value,\n            PrimitiveType.Binary => ((OpenApiBinary)value).Value,\n            PrimitiveType.Boolean => ((OpenApiBoolean)value).Value,\n            PrimitiveType.Date => ((OpenApiDate)value).Value,\n            PrimitiveType.DateTime => ((OpenApiDateTime)value).Value,\n            PrimitiveType.Password => ((OpenApiPassword)value).Value,\n            _ => throw new KernelException($\"The value type '{value.PrimitiveType}' of {entityDescription} '{entityName}' is not supported.\"),\n        };\n    }\n\n    /// <summary>\n    /// Asserts the successful reading of OpenAPI document.\n    /// </summary>\n    /// <param name=\"readResult\">The reading results to be checked.</param>\n    /// <param name=\"ignoreNonCompliantErrors\">Flag indicating whether to ignore non-compliant errors.\n    /// If set to true, the parser will not throw exceptions for non-compliant documents.\n    /// Please note that enabling this option may result in incomplete or inaccurate parsing results.\n    /// </param>\n    private void AssertReadingSuccessful(ReadResult readResult, bool ignoreNonCompliantErrors)\n    {\n        if (readResult.OpenApiDiagnostic.Errors.Any())\n        {\n            var title = readResult.OpenApiDocument.Info?.Title;\n            var errors = string.Join(\";\", readResult.OpenApiDiagnostic.Errors);\n","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Functions/Functions.OpenApi/OpenApi/OpenApiDocumentParser.cs#L577-L613","documentation":"GetParameterValue converts an OpenAPI default value (IOpenApiAny / IOpenApiPrimitive) into a .NET object. It handles Integer, Long, Float, Double, String, Byte, Binary, Boolean, Date, DateTime, Password; the switch default raises KernelException naming the primitive type that fell through. In practice the unhandled case is PrimitiveType.Null (and any future type), so a default value parsed as a null primitive triggers it.","triggerScenarios":"An OpenAPI schema property or parameter whose 'default' is explicitly JSON null, parsed by the OpenAPI reader as an OpenApiNull primitive (PrimitiveType.Null), which has no arm in the switch. Less commonly, a default expressed in a primitive form the reader maps to an exotic PrimitiveType.","commonSituations":"Specs generated by tools that emit 'default: null' (some Python/Spring generators do), specs hand-edited to set default: null to mean 'optional', or auto-generated specs that emit default values for enum/object-typed fields that the reader coerces into an unusual primitive.","solutions":["Remove the 'default: null' (or replace with an actual value) from the offending property/parameter in the OpenAPI spec.","If null is intended to mean 'no default', delete the default key entirely rather than setting it to null.","Exclude the operation containing the property via OpenApiFunctionExecutionParameters.OperationsToExclude.","In a fork, add a PrimitiveType.Null arm returning null in GetParameterValue."],"exampleFix":"// before\n//  properties:\n//    nickname:\n//      type: string\n//      default: null\n// after\n//  properties:\n//    nickname:\n//      type: string\n//      # no default key","handlingStrategy":"validation","validationCode":"// Scan for 'default: null' (the typical trigger) or exotic primitives in the spec text/JSON.\nusing System.Text.Json.Nodes;\nbool HasRiskyDefaults(JsonNode node)\n{\n    if (node is JsonObject o)\n    {\n        if (o.TryGetPropertyValue(\"default\", out var d) && d is JsonValue v && v.TryGetValue<object>(out var val) && val is null)\n            return true;\n        foreach (var child in o.Values)\n            if (child is not null && HasRiskyDefaults(child)) return true;\n    }\n    else if (node is JsonArray a)\n        foreach (var item in a)\n            if (item is not null && HasRiskyDefaults(item)) return true;\n    return false;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    var plugin = await kernel.CreatePluginFromOpenApiAsync(\"api\", specStream);\n}\ncatch (KernelException ex) when (ex.Message.Contains(\"value type\") && ex.Message.Contains(\"is not supported\"))\n{\n    // the message names the primitive type and entity; remove that default from the spec and retry\n}","preventionTips":["Do not emit 'default: null' in generated specs; remove the default key instead.","Lint generated specs for default values on non-scalar fields.","Keep defaults to the supported primitive forms (string/number/integer/boolean)."],"tags":["openapi","dotnet","schema-default","configuration"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}