greenrobot/greenDAO · error · DaoException
Unsupported operation
Error message
Unsupported operation: ${operation.type} What it means
executeOperation switches over AsyncOperation.Type to dispatch to the right DAO/session method. The default branch throws DaoException when the operation's type has no handler — i.e. an unknown or unsupported operation type reached the executor, typically from an older/newer greendao mismatch or custom code crafting operations.
Solutions
- Verify all greendao artifacts come from a single consistent version; remove duplicate/stale DaoCore jars from the classpath.
- Log operation.type to identify which operation kind is unsupported, and upgrade greendao to a version that handles it.
- Avoid constructing AsyncOperation instances manually with arbitrary types; use the AsyncSession API methods.
- After an AsyncSession.clear() or upgrade, clean/rebuild the project to avoid stale compiled classes.
Example fix
// build.gradle: before def versions = [greendao: '3.2.2', greendaoApi: '3.1.0'] // mismatched // after def versions = [greendao: '3.3.0', greendaoApi: '3.3.0'] // aligned
Defensive patterns
Strategy: validation
Validate before calling
// ensure a single greendao version on the classpath
Set<String> versions = classpathArtifactsMatching("org.greenrobot:greendao");
if (versions.size() != 1) throw new IllegalStateException("mixed greendao versions: " + versions); Try / catch
try {
asyncSession.insert(entity);
} catch (DaoException e) {
if (e.getMessage().startsWith("Unsupported operation:")) {
log.severe("greendao version mismatch or unhandled op type");
}
} Prevention
- Pin all org.greenrobot artifacts to the same version in Gradle
- Never construct AsyncOperation objects manually with raw types; use AsyncSession methods
- Clean rebuild after upgrading greendao to avoid stale classes
When it happens
Trigger: An AsyncOperation whose type is not one of the handled cases (e.g. a type added in a newer greendao release executed by an older core, or custom AsyncOperation construction with an unhandled type).
Common situations: Mixed greendao/greendao-api versions on the classpath (duplicate jars), shading/repackaging that splits classes, or framework code generating operation types this build's executor doesn't know.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- This operation did not yet complete
- Expected unique result, but count was
- Cannot delete entity, key is null
- Entity does not exist in the database anymore
- Cannot update entity without key - was it inserted before?
AI-assisted analysis of greenrobot/greenDAO@0bbb338e17 (2026-09-08).
Data as JSON: /api/errors/3d6fca3357c53793.
Report an issue: GitHub.
Appendix: source
Thrown at DaoCore/src/main/java/org/greenrobot/greendao/async/AsyncOperationExecutor.java:335
operation.dao.deleteByKey(operation.parameter);
break;
case DeleteAll:
operation.dao.deleteAll();
break;
case Load:
operation.result = operation.dao.load(operation.parameter);
break;
case LoadAll:
operation.result = operation.dao.loadAll();
break;
case Count:
operation.result = operation.dao.count();
break;
case Refresh:
operation.dao.refresh(operation.parameter);
break;
default:
throw new DaoException("Unsupported operation: " + operation.type);
}
} catch (Throwable th) {
operation.throwable = th;
}
operation.timeCompleted = System.currentTimeMillis();
// Do not set it to completed here because it might be a merged TX
}
private void executeTransactionRunnable(AsyncOperation operation) {
Database db = operation.getDatabase();
db.beginTransaction();
try {
((Runnable) operation.parameter).run();
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}View on GitHub (pinned to 0bbb338e17)