{"record":{"id":"23a820cbef218b8b","repo":"hyperledger/fabric","slug":"failed-obtaining-query-executor-v","errorCode":null,"errorMessage":"failed obtaining query executor: %v","messagePattern":"failed obtaining query executor: (.+?)","errorType":"exception","errorClass":"VSCCExecutionFailureError","httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v12/validation_logic.go","lineNumber":404,"sourceCode":"\tvar collectionsConfigLedger []byte\n\tif len(lsccrwset.Writes) == 2 {\n\t\tkey := privdata.BuildCollectionKVSKey(cdRWSet.Name)\n\t\tif lsccrwset.Writes[1].Key != key {\n\t\t\treturn policyErr(fmt.Errorf(\"invalid key for the collection of chaincode %s:%s; expected '%s', received '%s'\",\n\t\t\t\tcdRWSet.Name, cdRWSet.Version, key, lsccrwset.Writes[1].Key))\n\t\t}\n\n\t\tcollectionsConfigLedger = lsccrwset.Writes[1].Value\n\t}\n\n\tif !bytes.Equal(collectionsConfigArg, collectionsConfigLedger) {\n\t\treturn policyErr(fmt.Errorf(\"collection configuration arguments supplied for chaincode %s:%s do not match the configuration in the lscc writeset\",\n\t\t\tcdRWSet.Name, cdRWSet.Version))\n\t}\n\n\tchannelState, err := vscc.stateFetcher.FetchState()\n\tif err != nil {\n\t\treturn &commonerrors.VSCCExecutionFailureError{Err: fmt.Errorf(\"failed obtaining query executor: %v\", err)}\n\t}\n\tdefer channelState.Done()\n\n\tstate := &state{channelState}\n\n\t// The following condition check added in v1.1 may not be needed as it is not possible to have the chaincodeName~collection key in\n\t// the lscc namespace before a chaincode deploy. To avoid forks in v1.2, the following condition is retained.\n\tif lsccFunc == lscc.DEPLOY {\n\t\tcolCriteria := privdata.CollectionCriteria{Channel: channelName, Namespace: cdRWSet.Name}\n\t\tccp, err := privdata.RetrieveCollectionConfigPackageFromState(colCriteria, state)\n\t\tif err != nil {\n\t\t\t// fail if we get any error other than NoSuchCollectionError\n\t\t\t// because it means something went wrong while looking up the\n\t\t\t// older collection\n\t\t\tif _, ok := err.(privdata.NoSuchCollectionError); !ok {\n\t\t\t\treturn &commonerrors.VSCCExecutionFailureError{\n\t\t\t\t\tErr: fmt.Errorf(\"unable to check whether collection existed earlier for chaincode %s:%s\",\n\t\t\t\t\t\tcdRWSet.Name, cdRWSet.Version),","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v12/validation_logic.go#L386-L422","documentation":"validateRWSetAndCollection calls vscc.stateFetcher.FetchState() to get a query executor against the ledger. If that fails, the error is wrapped in a VSCCExecutionFailureError (a transient execution failure, not an endorsement-policy error). Common underlying causes are the ledger/store being unavailable or an internal database error.","triggerScenarios":"FetchState() returns an error while validating an lscc deploy with collections — e.g. the peer cannot obtain a query executor from the state provider because the backing state database (LevelDB/CouchDB) is down, misconfigured, or the ledger is being recovered.","commonSituations":"CouchDB container stopped or unreachable during block validation; peer starting up and ledger state provider not yet ready; disk full or database corruption on the state store.","solutions":["Check the peer logs immediately preceding this error for the underlying query-executor failure and fix the state database (verify CouchDB/LevelDB is running and reachable).","Restart the peer once the state store is healthy; blocks will be revalidated.","For CouchDB, verify CORE_LEDGER_STATE_COUCHDBCONFIG_* settings and network connectivity from the peer container.","If this recurs during startup, ensure ordering/validation services don't race peer ledger initialization."],"exampleFix":"// before: peer cannot reach CouchDB\ndocker start couchdb  # or fix CORE_LEDGER_STATE_COUCHDBCONFIG_ADDRESS\n// after: verify state store availability before starting peer\ncurl -f http://couchdb:5984/_up && peer node start","handlingStrategy":"retry","validationCode":"// Health-check the state store before submitting deploys\n// e.g. for CouchDB:\n// curl -f http://couchdb:5984/_up || restart couchdb before invoking lscc\n","typeGuard":null,"tryCatchPattern":"// VSCCExecutionFailureError is transient — retry validation/commit\nif _, ok := err.(*commonerrors.VSCCExecutionFailureError); ok {\n  // log underlying cause and retry after checking the state database\n  logger.Warnf(\"transient VSCC failure, retrying: %v\", err)\n  return retryWithBackoff(validateTx)\n}","preventionTips":["Monitor CouchDB/LevelDB health and alert before deploying chaincode","Ensure peer and state database containers start in a healthy order (docker-compose depends_on/healthchecks)","Watch disk space on peers running LevelDB state stores","Treat VSCCExecutionFailureError as retryable, unlike policy errors"],"tags":["fabric","vscc","ledger","state-database","execution-failure"],"backgroundTag":"query-executor-unavailable","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}