{"record":{"id":"a64bae0e4cefcd70","repo":"BoundaryML/baml","slug":"unknown-name-could-not-determine-if-it-was-a-class-enum-or","errorCode":null,"errorMessage":"Unknown name (could not determine if it was a class, enum, or type alias): {0}","messagePattern":"Unknown name \\(could not determine if it was a class, enum, or type alias\\): (.+?)","errorType":"error_code","errorClass":"ConvertError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_sap/src/sap_model/convert.rs","lineNumber":38,"sourceCode":"impl crate::sap_model::TypeIdent for DefKey {}\n\n#[derive(thiserror::Error, Debug)]\npub enum ConvertError {\n    #[error(\"Failed to parse float: {0}\")]\n    ParseFloat(#[from] std::num::ParseFloatError),\n    #[error(\"Unknown media kind\")]\n    UnknownMediaKind,\n    #[error(\"Float literals cannot be parsed\")]\n    FloatLiteral,\n    #[error(\"Non-parsable type: {0:?}\")]\n    NonParsableType(Box<SapTy>),\n    #[error(\"Unknown class: {0}\")]\n    UnknownClass(DefKey),\n    #[error(\"Unknown enum: {0}\")]\n    UnknownEnum(DefKey),\n    #[error(\"Unknown type alias: {0}\")]\n    UnknownTypeAlias(DefKey),\n    #[error(\"Unknown name (could not determine if it was a class, enum, or type alias): {0}\")]\n    UnknownName(DefKey),\n    #[error(\"Could not add a type to the database as the name `{0}` is already present\")]\n    AlreadyPresent(DefKey),\n    #[error(\"Recursion depth exceeded for {0}\")]\n    RecursionDepthExceeded(&'static str),\n    #[error(\"Unions must be flattened\")]\n    UnflattenedUnion,\n    /// Something like `type A = B; type B = A;` is invalid.\n    #[error(\"Recursive type alias without indirection: {0}\")]\n    DirectRecursiveTypeAlias(DefKey),\n    #[error(\"Internal error (please report): {0}\")]\n    InternalError(&'static str),\n}\n\nconst MAX_RECURSION_DEPTH: usize = 16;\n\n/// Contains stuff from [`sys_types::SysOpContext`] that we need for converting to the sap model.\n///","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_sap/src/sap_model/convert.rs#L20-L56","documentation":"ConvertError::UnknownName(DefKey) is raised in convert_type_alias when an alias's inner type resolves to Ty::Unresolved(inner_name) and the name is not found among classes, enums, or type aliases. The converter cannot determine what kind of named type it is.","triggerScenarios":"TypeCtx::build_db converting a type alias whose flattened inner reference names something absent from all three definition maps (class_definitions, enum_definitions, type_alias_definitions).","commonSituations":"A dangling reference after deleting a class/enum/alias; a name typo; a type from an unloaded module referenced by an alias.","solutions":["Declare the missing name as a class, enum, or type alias in your BAML sources.","Check spelling — the error means the name matches none of the three known kinds.","Ensure all modules defining referenced types are loaded into the SysOpContext before building the SAP model."],"exampleFix":"// before\ntype Result = UnknownThing\n// after\nclass UnknownThing { ok: bool }\ntype Result = UnknownThing","handlingStrategy":"validation","validationCode":"// A name must be exactly one of: class, enum, or alias\nfn name_is_known(ctx: &TypeCtx, key: &DefKey) -> bool {\n    ctx.class_definitions.contains_key(key)\n        || ctx.enum_definitions.contains_key(key)\n        || ctx.type_alias_definitions.contains_key(key)\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(ConvertError::UnknownName(key)) => eprintln!(\"{key:?} is not a class, enum, or type alias — declare it\"),\n    other => other,\n}","preventionTips":["Never delete a named type without searching for references first.","Enable compiler warnings for unresolved references in BAML sources.","Qualify names across modules to avoid ambiguity and typos."],"tags":["sap","baml","undefined-reference","name-resolution"],"backgroundTag":"resource-not-found","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}