{"record":{"id":"68ae52c104fcbf17","repo":"prestodb/presto","slug":"missing-table-68ae52","errorCode":"MISSING_TABLE","errorMessage":"Table '%s' does not exist","messagePattern":"Table '(.+?)' does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/TruncateTableTask.java","lineNumber":72,"sourceCode":"        if (!metadataResolver.catalogExists(tableName.getCatalogName())) {\n            throw new SemanticException(MISSING_CATALOG, \"Catalog '%s' does not exist\", tableName.getCatalogName());\n        }\n\n        if (!metadataResolver.schemaExists(tableName.getCatalogSchemaName())) {\n            throw new SemanticException(MISSING_SCHEMA, statement, \"Schema '%s' does not exist\", tableName.getSchemaName());\n        }\n\n        if (metadataResolver.isMaterializedView(tableName)) {\n            throw new SemanticException(NOT_SUPPORTED, statement, \"Cannot truncate a materialized view\");\n        }\n\n        if (metadataResolver.isView(tableName)) {\n            throw new SemanticException(NOT_SUPPORTED, statement, \"Cannot truncate a view\");\n        }\n\n        Optional<TableHandle> tableHandle = metadata.getMetadataResolver(session).getTableHandle(tableName);\n        if (!tableHandle.isPresent()) {\n            throw new SemanticException(MISSING_TABLE, statement, \"Table '%s' does not exist\", tableName);\n        }\n\n        accessControl.checkCanTruncateTable(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);\n\n        metadata.truncateTable(session, tableHandle.get());\n\n        return immediateFuture(null);\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":82,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/TruncateTableTask.java#L54-L82","documentation":"TruncateTableTask validates the target before truncating; this fires when the qualified table name does not resolve to an existing table in the metastore (and IF EXISTS was not given), raising MISSING_TABLE.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/TruncateTableTask.java:72 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the table name and its schema qualification with SHOW TABLES","Confirm the table was not dropped or renamed concurrently","Create the table before truncating it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}