hasura/graphql-engine · warning · ScalarTypesIssue
Scalar type {type_name} conflicts with existing inbuilt type
Error message
Scalar type {type_name} conflicts with existing inbuilt type What it means
An issue (not hard error) where a custom scalar type's name collides with a built-in scalar type name.
Source
Thrown at v3/crates/metadata-resolve/src/stages/scalar_types/types.rs:24
use open_dds::types::CustomTypeName;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct ScalarTypeRepresentation {
pub graphql_type_name: Option<ast::TypeName>,
#[serde(default = "serde_ext::ser_default")]
#[serde(skip_serializing_if = "serde_ext::is_ser_default")]
pub description: Option<String>,
}
pub struct ScalarTypesOutput {
pub scalar_types: BTreeMap<Qualified<CustomTypeName>, ScalarTypeRepresentation>,
pub issues: Vec<ScalarTypesIssue>,
}
#[derive(Debug, thiserror::Error)]
pub enum ScalarTypesIssue {
#[error("Scalar type {type_name} conflicts with existing inbuilt type")]
NameConflictsWithBuiltInType { type_name: CustomTypeName },
}
impl ShouldBeAnError for ScalarTypesIssue {
fn should_be_an_error(&self, flags: &open_dds::flags::OpenDdFlags) -> bool {
match self {
ScalarTypesIssue::NameConflictsWithBuiltInType { .. } => flags.contains(
open_dds::flags::Flag::DisallowScalarTypeNamesConflictingWithInbuiltTypes,
),
}
}
}
View on GitHub (pinned to 724551b9ae)
Solutions
- Rename the custom scalar type to something not used by builtin scalars
- Check the list of builtin scalar names for the version in use
Example fix
// before kind: ScalarType name: String // after kind: ScalarType name: MyString
Defensive patterns
Strategy: validation
Validate before calling
const BUILTIN: [&str; 6] = ["String", "Int", "Float", "Boolean", "ID", "uuid"];
if BUILTIN.contains(&scalar_type.name.as_str()) {
return Err("custom scalar shadows builtin type");
} Prevention
- Prefix custom scalar names (e.g. MyString) to avoid builtin collisions
When it happens
Trigger: Defining a ScalarType with a name that matches an inbuilt scalar (e.g. String, Int, Float, Boolean, ID, uuid, date, etc.).
Common situations: Custom scalars named after builtin types, which shadows or conflicts with the inbuilt representations.
Related errors
- duplicate field name {field_name} generated while building o
- the operand type '{operand_type}' must be a scalar type
- the boolean expression '{type_name}' has a GraphQL field nam
- the aggregate expression '{aggregate_expression}' is used wi
- scalar type representation required for type {scalar_type:}
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/eae382b7bdad01f8.
Report an issue: GitHub.