{"record":{"id":"bfd32a72df077a3e","repo":"dgraph-io/dgraph","slug":"error-deleting-old-predicate-s","errorCode":null,"errorMessage":"error deleting old predicate %s","messagePattern":"error deleting old predicate (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upgrade/change_v21.03.0.go","lineNumber":129,"sourceCode":"\t\"dgraph.graphql.p_sha256hash\":      {},\n}\n\nvar deprecatedTypes = map[string]struct{}{\n\t\"dgraph.type.cors\":       {},\n\t\"dgraph.graphql.history\": {},\n}\n\nfunc dropDeprecated(dg *dgo.Dgraph) error {\n\tif !Upgrade.Conf.GetBool(deleteOld) {\n\t\treturn nil\n\t}\n\tfor pred := range deprecatedPreds {\n\t\top := &api.Operation{\n\t\t\tDropOp:    api.Operation_ATTR,\n\t\t\tDropValue: pred,\n\t\t}\n\t\tif err := alterWithClient(dg, op); err != nil {\n\t\t\treturn errors.Wrapf(err, \"error deleting old predicate %s\", pred)\n\t\t}\n\t}\n\tfor typ := range deprecatedTypes {\n\t\top := &api.Operation{\n\t\t\tDropOp:    api.Operation_TYPE,\n\t\t\tDropValue: typ,\n\t\t}\n\t\tif err := alterWithClient(dg, op); err != nil {\n\t\t\treturn errors.Wrapf(err, \"error deleting old type %s\", typ)\n\t\t}\n\t}\n\tfmt.Println(\"Successfully dropped the deprecated predicates\")\n\treturn nil\n}\n\nfunc upgradePersitentQuery() error {\n\tdg, cb := x.GetDgraphClient(Upgrade.Conf, hasAclCreds())\n\tdefer cb()","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/upgrade/change_v21.03.0.go#L111-L147","documentation":"dropDeprecated iterates over deprecatedPreds and issues an ATTR drop operation through alterWithClient. When the Dgraph alter call fails for a given predicate, the error is wrapped as 'error deleting old predicate %s'. It means the schema migration could not remove a deprecated predicate from the v21.03 schema.","triggerScenarios":"alterWithClient returns an error when dropping one of the predicates in deprecatedPreds — e.g. the Dgraph Alpha alter endpoint is unreachable, ACL forbids the operation, or the drop op is rejected server-side.","commonSituations":"Running the upgrade tool against a cluster where the user lacks alter permissions (ACL enabled without admin creds), Alpha address misconfigured in upgrade flags, or a network partition during schema migration.","solutions":["Verify the Alpha address/credentials passed to the upgrade command are correct and reachable.","Re-run the upgrade with admin ACL credentials (or --acl credentials) so alter operations are permitted.","Check Alpha logs for the underlying alter failure and fix the root cause (e.g. read-only mode, disk full).","Manually drop the predicate via /alter once the cluster is healthy and re-run upgrade."],"exampleFix":"// before\nif err := alterWithClient(dg, op); err != nil {\n\treturn errors.Wrapf(err, \"error deleting old predicate %s\", pred)\n}\n// after\nif err := alterWithClient(dg, op); err != nil {\n\treturn errors.Wrapf(err, \"error deleting old predicate %s (check ACL creds and Alpha connectivity)\", pred)\n}","handlingStrategy":"try-catch","validationCode":"curl -s http://localhost:8080/alter -XPOST -d '{\"drop_attr\": \"old.pred\"}'  # verify alter works and creds are valid before upgrade","typeGuard":null,"tryCatchPattern":"if err := upgradeCORS(); err != nil {\n\tif strings.Contains(err.Error(), \"error deleting old predicate\") {\n\t\t// inspect wrapped cause: retry with admin ACL creds or drop predicate manually\n\t}\n\treturn err\n}","preventionTips":["Run the upgrade with admin/guardian ACL credentials","Test alter endpoint reachability before starting the migration","Keep the cluster writable (no drain/read-only mode) during upgrades"],"tags":["dgraph","upgrade","alter","acl"],"backgroundTag":"alter-operation-failed","analyzedSha":"759e242be62c91f8d084da06ad0c8d21256d9c07","analyzedAt":"2026-09-01T14:42:12.034Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}