{"record":{"id":"5f71b63a8035470b","repo":"hasura/graphql-engine","slug":"expected-an-object-value-of-type-expected-but-g","errorCode":null,"errorMessage":"Expected an object value of type {expected:} but got value {actual:}","messagePattern":"Expected an object value of type (.+?) but got value (.+?)","errorType":"validation","errorClass":"TypecheckIssue","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/helpers/typecheck.rs","lineNumber":30,"sourceCode":"/// Errors that can occur when typechecking a value\npub enum TypecheckError {\n    #[error(\"Expected a value of type {expected:} but got value {actual:}\")]\n    ScalarTypeMismatch {\n        expected: open_dds::types::InbuiltType,\n        actual: serde_json::Value,\n    },\n    #[error(\"Error in array item: {inner_error:}\")]\n    ArrayItemMismatch { inner_error: Box<TypecheckError> },\n    #[error(\"Expected an array but instead got value {value:}\")]\n    NonArrayValue { value: serde_json::Value },\n    #[error(\"Expected a non-null value but received null\")]\n    NullInNonNullableColumn,\n}\n\n#[derive(Error, Debug, PartialEq)]\n/// Issues that can occur when typechecking a value against an object type\npub enum TypecheckIssue {\n    #[error(\"Expected an object value of type {expected:} but got value {actual:}\")]\n    ObjectTypeMismatch {\n        expected: Qualified<CustomTypeName>,\n        actual: serde_json::Value,\n    },\n\n    #[error(\"Typecheck failed for field {field_name:} in object type {object_type:}: {error:}\")]\n    ObjectTypeField {\n        field_name: FieldName,\n        object_type: Qualified<CustomTypeName>,\n        error: TypecheckError,\n    },\n\n    #[error(\n        \"Found a literal value but the argument is a boolean expression type '{boolean_expression_type_name}'\"\n    )]\n    LiteralValueUsedForBooleanExpression {\n        boolean_expression_type_name: Qualified<CustomTypeName>,\n    },","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/helpers/typecheck.rs#L12-L48","documentation":"A TypecheckIssue (not TypecheckError) raised when typechecking a value against an object type (Qualified<CustomTypeName>) and the JSON value is not a JSON object. It names the expected custom object type and shows the actual value received.","triggerScenarios":"Passing a scalar, array, or string literal where an object type is expected, e.g. an argument typed as a custom object type given default: \"something\".","commonSituations":"Misconfigured defaults for object-typed arguments, confusing an object type with its name (passing the type name string instead of a mapping), malformed YAML that parses as a scalar instead of a map.","solutions":["Replace the literal with a mapping of field names to values","Verify the value's keys match the fields of the named object type","Check YAML indentation so the default is parsed as a map"],"exampleFix":"// before\n# Where type is object type User\ndefault: \"User\"\n\n// after\ndefault:\n  id: 1\n  name: alice","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn is_json_object(v: &serde_json::Value) -> bool {\n    v.is_object()\n}","tryCatchPattern":"if let TypecheckIssue::ObjectTypeMismatch { expected, actual } = issue {\n    eprintln!(\"value for {expected:?} must be a mapping, got {actual}\");\n}","preventionTips":["Use YAML mappings (key: value) for object-typed defaults","Validate defaults against the object type's fields before deploying","Don't pass type names as strings where object literals are expected"],"tags":["metadata","typecheck","object-type","json"],"backgroundTag":"value-type-mismatch","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}