{"record":{"id":"0d8057ff35ce5dc7","repo":"dgraph-io/dgraph","slug":"error-deleting-old-type-s","errorCode":null,"errorMessage":"error deleting old type %s","messagePattern":"error deleting old type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upgrade/change_v21.03.0.go","lineNumber":138,"sourceCode":"\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()\n\n\tjwt, err := getAccessJwt()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"while getting jwt auth token\")\n\t}\n\n\t// Get persisted queries.\n\tqueryData := make(map[string][]pquery)\n\tif err := getQueryResult(dg, queryPersistedQuery_v21_03_0, &queryData); err != nil {","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/dgraph-io/dgraph/blob/759e242be62c91f8d084da06ad0c8d21256d9c07/upgrade/change_v21.03.0.go#L120-L156","documentation":"dropDeprecated iterates deprecatedTypes and issues a TYPE drop operation via alterWithClient. On failure the error is wrapped as 'error deleting old type %s'. The deprecated Dgraph type (e.g. old internal types) could not be dropped during the v21.03 migration.","triggerScenarios":"alterWithClient fails while dropping a type listed in deprecatedTypes — unreachable Alpha, insufficient ACL permissions, or server-side rejection of the DropOp TYPE operation.","commonSituations":"ACL-enabled clusters run without admin creds; Alpha in read-only/drain mode; misconfigured upgrade target address; transient network failure mid-migration.","solutions":["Re-run the upgrade with admin credentials so TYPE drops are allowed.","Confirm the Alpha alter endpoint is reachable and not in read-only mode.","Check Alpha logs for the root alter error and address it (disk, permissions).","Drop the type manually via /alter and resume the upgrade."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"curl -s http://localhost:8080/alter -XPOST -d '{\"drop_op\": \"TYPE\", \"drop_value\": \"test.type\"}'","typeGuard":null,"tryCatchPattern":"if err := upgradeCORS(); err != nil {\n\tif strings.Contains(err.Error(), \"error deleting old type\") {\n\t\t// retry with elevated creds or drop type via /alter manually\n\t}\n\treturn err\n}","preventionTips":["Ensure ACL admin creds are supplied for TYPE drops","Verify Alpha is not read-only before upgrading","Monitor Alpha logs during the upgrade run"],"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-08T10:18:20.063Z"}