dgraph-io/dgraph · error

error deleting old type %s

Error message

error deleting old type %s

What it means

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.

Source

Thrown at upgrade/change_v21.03.0.go:138

	if !Upgrade.Conf.GetBool(deleteOld) {
		return nil
	}
	for pred := range deprecatedPreds {
		op := &api.Operation{
			DropOp:    api.Operation_ATTR,
			DropValue: pred,
		}
		if err := alterWithClient(dg, op); err != nil {
			return errors.Wrapf(err, "error deleting old predicate %s", pred)
		}
	}
	for typ := range deprecatedTypes {
		op := &api.Operation{
			DropOp:    api.Operation_TYPE,
			DropValue: typ,
		}
		if err := alterWithClient(dg, op); err != nil {
			return errors.Wrapf(err, "error deleting old type %s", typ)
		}
	}
	fmt.Println("Successfully dropped the deprecated predicates")
	return nil
}

func upgradePersitentQuery() error {
	dg, cb := x.GetDgraphClient(Upgrade.Conf, hasAclCreds())
	defer cb()

	jwt, err := getAccessJwt()
	if err != nil {
		return errors.Wrap(err, "while getting jwt auth token")
	}

	// Get persisted queries.
	queryData := make(map[string][]pquery)
	if err := getQueryResult(dg, queryPersistedQuery_v21_03_0, &queryData); err != nil {

View on GitHub (pinned to 759e242be6)

Solutions

  1. Re-run the upgrade with admin credentials so TYPE drops are allowed.
  2. Confirm the Alpha alter endpoint is reachable and not in read-only mode.
  3. Check Alpha logs for the root alter error and address it (disk, permissions).
  4. Drop the type manually via /alter and resume the upgrade.
Defensive patterns

Strategy: try-catch

Validate before calling

curl -s http://localhost:8080/alter -XPOST -d '{"drop_op": "TYPE", "drop_value": "test.type"}'

Try / catch

if err := upgradeCORS(); err != nil {
	if strings.Contains(err.Error(), "error deleting old type") {
		// retry with elevated creds or drop type via /alter manually
	}
	return err
}

Prevention

When it happens

Trigger: alterWithClient fails while dropping a type listed in deprecatedTypes — unreachable Alpha, insufficient ACL permissions, or server-side rejection of the DropOp TYPE operation.

Common situations: ACL-enabled clusters run without admin creds; Alpha in read-only/drain mode; misconfigured upgrade target address; transient network failure mid-migration.

Related errors


AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01). Data as JSON: /api/errors/0d8057ff35ce5dc7. Report an issue: GitHub.