{"record":{"id":"aeb54662b90aa69f","repo":"conductor-oss/conductor","slug":"error-fetching-workflow-def-s-d","errorCode":null,"errorMessage":"Error fetching workflow def: %s/%d","messagePattern":"Error fetching workflow def: (.+?)/(.+?)","errorType":"exception","errorClass":"TransientException","httpStatus":500,"severity":"error","filePath":"cassandra-persistence/src/main/java/com/netflix/conductor/cassandra/dao/CassandraMetadataDAO.java","lineNumber":250,"sourceCode":"    @Override\n    public Optional<WorkflowDef> getWorkflowDef(String name, int version) {\n        try {\n            recordCassandraDaoRequests(\"getWorkflowDef\");\n            ResultSet resultSet = session.execute(selectWorkflowDefStatement.bind(name, version));\n            WorkflowDef workflowDef =\n                    Optional.ofNullable(resultSet.one())\n                            .map(\n                                    row ->\n                                            readValue(\n                                                    row.getString(WORKFLOW_DEFINITION_KEY),\n                                                    WorkflowDef.class))\n                            .orElse(null);\n            return Optional.ofNullable(workflowDef);\n        } catch (DriverException e) {\n            Monitors.error(CLASS_NAME, \"getTaskDef\");\n            String errorMsg = String.format(\"Error fetching workflow def: %s/%d\", name, version);\n            LOGGER.error(errorMsg, e);\n            throw new TransientException(errorMsg, e);\n        }\n    }\n\n    @Override\n    public void removeWorkflowDef(String name, Integer version) {\n        try {\n            session.execute(deleteWorkflowDefStatement.bind(name, version));\n            session.execute(\n                    deleteWorkflowDefIndexStatement.bind(\n                            WORKFLOW_DEF_INDEX_KEY, getWorkflowDefIndexValue(name, version)));\n        } catch (DriverException e) {\n            Monitors.error(CLASS_NAME, \"removeWorkflowDef\");\n            String errorMsg =\n                    String.format(\"Failed to remove workflow definition: %s/%d\", name, version);\n            LOGGER.error(errorMsg, e);\n            throw new TransientException(errorMsg, e);\n        }\n    }","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/cassandra-persistence/src/main/java/com/netflix/conductor/cassandra/dao/CassandraMetadataDAO.java#L232-L268","documentation":"Thrown when a DriverException occurs while getWorkflowDef reads a single workflow definition row by name+version. Wrapped as TransientException. Note: the adjacent Monitors.error call is mislabelled 'getTaskDef' (a copy-paste artefact), but the thrown message correctly references the workflow def fetch.","triggerScenarios":"The SELECT for a workflow definition (row.getString(WORKFLOW_DEFINITION_KEY) + JSON deserialization) fails because session.execute raised a DriverException - read timeout, unavailable, or connection error.","commonSituations":"Reading a workflow def during a Cassandra degradation or rolling restart; the workflow_def table replica set is temporarily short of the configured read consistency; deserialization succeeds but the read itself timed out.","solutions":["Verify cluster connectivity and that read consistency can be met (replication factor vs conductor.cassandra.readConsistencyLevel).","Retry the read - this is a TransientException.","Confirm the workflow_def table and keyspace are initialized.","Inspect the wrapped DriverException in logs for the precise driver failure."],"exampleFix":"// before: single read attempt\nWorkflowDef def = metadataDAO.getWorkflowDef(name, version)\n    .orElseThrow(() -> new NotFoundException(name));\n\n// after: retry transient reads\nWorkflowDef def = RetryUtils.retryOn(TransientException.class, 3,\n        Duration.ofMillis(150),\n        () -> metadataDAO.getWorkflowDef(name, version))\n    .orElseThrow(() -> new NotFoundException(name));","handlingStrategy":"retry","validationCode":"// Pre-flight: verify session is alive before reading\nif (cassandraSession.isClosed()) {\n    throw new IllegalStateException(\"Cassandra session is closed; cannot read workflow def\");\n}","typeGuard":null,"tryCatchPattern":"// Retry transient read failures for a single workflow def\ntry {\n    return metadataDAO.getWorkflowDef(name, version);\n} catch (TransientException e) {\n    return backoffAndRetry(\n            () -> metadataDAO.getWorkflowDef(name, version), 3);\n}","preventionTips":["Read workflow defs through a retry wrapper for TransientException.","Keep read consistency at quorum+ on multi-node clusters to avoid stale/failed reads.","Confirm the workflow_def table is present after deploys.","Cache frequently-read definitions to reduce driver load."],"tags":["cassandra","workflow-definition","transient","network","driver","read"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}