{"record":{"id":"608457a0711cb136","repo":"vitessio/vitess","slug":"stream-d-for-v-v-is-not-in-running-state-v","errorCode":null,"errorMessage":"stream %d for %v.%v is not in Running state: %v","messagePattern":"stream (.+?) for (.+?)\\.(.+?) is not in Running state: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/materializer.go","lineNumber":887,"sourceCode":"\t\t\tid, err := row[0].ToCastInt64()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tstate := binlogdatapb.VReplicationWorkflowState(binlogdatapb.VReplicationWorkflowState_value[row[1].ToString()])\n\t\t\tmessage := row[2].ToString()\n\t\t\tvar bls binlogdatapb.BinlogSource\n\t\t\tsourceBytes, err := row[3].ToBytes()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := prototext.Unmarshal(sourceBytes, &bls); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif sourceVindex.Owner == \"\" || !bls.StopAfterCopy {\n\t\t\t\t// If there's no owner or we've requested that the workflow NOT be stopped\n\t\t\t\t// after the copy phase completes, then all streams need to be running.\n\t\t\t\tif state != binlogdatapb.VReplicationWorkflowState_Running {\n\t\t\t\t\treturn fmt.Errorf(\"stream %d for %v.%v is not in Running state: %v\", id, targetShard.Keyspace(), targetShard.ShardName(), state)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// If there is an owner, all streams need to be stopped after copy.\n\t\t\t\tif state != binlogdatapb.VReplicationWorkflowState_Stopped || !strings.Contains(message, \"Stopped after copy\") {\n\t\t\t\t\treturn fmt.Errorf(\"stream %d for %v.%v is not in Stopped after copy state: %v, %v\", id, targetShard.Keyspace(), targetShard.ShardName(), state, message)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif sourceVindex.Owner != \"\" {\n\t\t// If there is an owner, we have to delete the streams.\n\t\terr := forAllTargets(func(targetShard *topo.ShardInfo) error {\n\t\t\ttargetPrimary, err := wr.ts.GetTablet(ctx, targetShard.PrimaryAlias)","sourceCodeStart":869,"sourceCodeEnd":905,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/materializer.go#L869-L905","documentation":"During vindex externalization validation, Wrangler checks each vreplication stream on the target shards. When the vindex has no owner (or StopAfterCopy is false), all streams must be in Running state; any other state (Copying, Error, Stopped) fails validation.","triggerScenarios":"ExternalizeVindex invoked while the backfill/lookup vreplication streams are still copying, in error, or were manually stopped, for an ownerless vindex.","commonSituations":"Running ExternalizeVindex before the copy phase completed; a stream failed mid-backfill; someone manually stopped the workflow via Workflow...Stop before externalizing an ownerless vindex.","solutions":["Check stream status with vtctldclient Workflow --workflow <name> Show and wait for all streams to be Running.","If a stream is in Error, fix the underlying cause (e.g. MySQL error on the target) and restart the workflow.","Restart stopped streams with the workflow Start command, then retry ExternalizeVindex.","If the vindex has an owner and should stop after copy, ensure the message contains 'Stopped after copy' — otherwise this branch does not apply."],"exampleFix":"// before: externalize while copying\nvtctldclient ExternalizeVindex commerce.corder_vdx\n// after: wait until streams are Running\nvtctldclient Workflow --workflow corder_vdx_vdx Show  # all Running\nvtctldclient ExternalizeVindex commerce.corder_vdx","handlingStrategy":"validation","validationCode":"shs, _ := wr.ts.GetVReplicationWorkflow(ctx, \"corder_vdx_vdx\")\nfor _, s := range shs.Streams {\n  if s.State != binlogdatapb.VReplicationWorkflowState_Running {\n    return fmt.Errorf(\"stream %d not running yet: %s\", s.Id, s.State)\n  }\n}","typeGuard":null,"tryCatchPattern":"if err := wr.ExternalizeVindex(ctx, name); err != nil {\n  if strings.Contains(err.Error(), \"is not in Running state\") {\n    // poll workflow status with backoff until all streams Running, then retry\n  }\n}","preventionTips":["Poll Workflow Show until every stream is Running before externalizing ownerless vindexes.","Do not manually stop ownerless vindex backfill workflows.","Investigate and fix Error-state streams before externalizing."],"tags":["vreplication","workflow-state","vindex"],"backgroundTag":"vreplication-stream-not-running","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}