{"record":{"id":"3e12a11b115309d1","repo":"prestodb/presto","slug":"property-s-for-s-cannot-have-a-null-value","errorCode":null,"errorMessage":"Property %s for %s cannot have a null value","messagePattern":"Property (.+?) for (.+?) cannot have a null value","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java","lineNumber":731,"sourceCode":"        }\n\n        private List<Property> buildProperties(\n                Object objectName,\n                StandardErrorCode errorCode,\n                Map<String, Object> properties,\n                Map<String, PropertyMetadata<?>> allProperties)\n        {\n            if (properties.isEmpty()) {\n                return Collections.emptyList();\n            }\n\n            ImmutableSortedMap.Builder<String, Expression> sqlProperties = ImmutableSortedMap.naturalOrder();\n\n            for (Map.Entry<String, Object> propertyEntry : properties.entrySet()) {\n                String propertyName = propertyEntry.getKey();\n                Object value = propertyEntry.getValue();\n                if (value == null) {\n                    throw new PrestoException(errorCode, format(\"Property %s for %s cannot have a null value\", propertyName, objectName));\n                }\n\n                PropertyMetadata<?> property = allProperties.get(propertyName);\n                if (!Primitives.wrap(property.getJavaType()).isInstance(value)) {\n                    throw new PrestoException(errorCode, format(\n                            \"Property %s for %s should have value of type %s, not %s\",\n                            propertyName,\n                            objectName,\n                            property.getJavaType().getName(),\n                            value.getClass().getName()));\n                }\n\n                Expression sqlExpression = getExpression(property, value);\n                sqlProperties.put(propertyName, sqlExpression);\n            }\n\n            return sqlProperties.build().entrySet().stream()\n                    .map(entry -> new Property(new Identifier(entry.getKey()), entry.getValue()))","sourceCodeStart":713,"sourceCodeEnd":749,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java#L713-L749","documentation":"While serializing table/schema properties back into SQL expressions (buildProperties), a property's stored value was null, which cannot be represented as a valid property expression. Presto throws the supplied errorCode to prevent emitting malformed CREATE TABLE/VIEW DDL.","triggerScenarios":"Connector metadata or a stored view/materialized-view definition contains a property key with a null value in its properties map, and SHOW CREATE (or propertyNodes) rebuilds that DDL.","commonSituations":"Buggy connector returning null property values; corrupted metastore entries; properties written by an older/other engine version with null semantics Presto rejects.","solutions":["Inspect the connector's metadata source (metastore) and remove or fix the null-valued property entry","Re-create the object with explicit, non-null property values","Report/fix the connector so it never stores null property values"],"exampleFix":"// before (metastore entry)\n{\"partitioned_by\": null}\n// after\n{\"partitioned_by\": [\"ds\"]}","handlingStrategy":"validation","validationCode":"Map<String, Object> props = tableProperties;\nprops.forEach((k, v) -> { if (v == null) throw new IllegalStateException(\"null property: \" + k); });","typeGuard":"function hasNoNullProperties(props) {\n  return Object.entries(props).every(([, v]) => v !== null && v !== undefined);\n}","tryCatchPattern":"try { session.execute(\"SHOW CREATE TABLE \" + name); } catch (PrestoException e) { if (e.getMessage().contains(\"cannot have a null value\")) { /* fix metastore entry */ } throw e; }","preventionTips":["Reject null property values in connector/metadata writers","Audit metastore entries for null properties after upgrades","Never hand-edit property maps without typed values"],"tags":["presto","properties","null-value","metadata"],"backgroundTag":"null-property-value","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"}