{"record":{"id":"bf5fa285078601c6","repo":"invoke-ai/InvokeAI","slug":"workflow-return-key-must-not-be-empty","errorCode":null,"errorMessage":"Workflow return key must not be empty.","messagePattern":"Workflow return key must not be empty\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/workflow_return.py","lineNumber":69,"sourceCode":"    version=\"1.0.0\",\n    classification=Classification.Beta,\n    use_cache=False,\n)\nclass WorkflowReturnValueInvocation(BaseInvocation):\n    \"\"\"Creates one named value for a callable workflow return.\"\"\"\n\n    key: str = InputField(default=\"\", description=\"The return key.\", title=\"Key\")\n    value: Any = InputField(\n        default=None,\n        description=\"The value returned under this key.\",\n        title=\"Value\",\n        ui_type=UIType.Any,\n    )\n\n    def invoke(self, context: InvocationContext) -> WorkflowReturnValueOutput:\n        key = self.key.strip()\n        if not key:\n            raise ValueError(\"Workflow return key must not be empty.\")\n        return WorkflowReturnValueOutput(value=WorkflowReturnValueField(key=key, value=self.value))\n\n\n@invocation(\n    \"workflow_return\",\n    title=\"Workflow Return\",\n    tags=[\"workflow\", \"return\", \"output\"],\n    category=\"workflow\",\n    version=\"1.0.0\",\n    classification=Classification.Beta,\n    use_cache=False,\n)\nclass WorkflowReturnInvocation(BaseInvocation):\n    \"\"\"Defines the explicit named result returned by a callable workflow.\"\"\"\n\n    values: WorkflowReturnValueField | list[WorkflowReturnValueField] = InputField(\n        default=[],\n        description=\"The named values returned to a calling workflow.\",","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/workflow_return.py#L51-L87","documentation":"The single-value Workflow Return invocation exports one named key/value pair from a workflow. A whitespace-only or empty key would produce an unnamed return value that downstream consumers cannot reference, so InvokeAI raises ValueError after stripping the input.","triggerScenarios":"Invoking the Workflow Return (single) node with key = \"\" or key = \"   \" (strips to empty).","commonSituations":"Leaving the key field at its default/blank in the workflow editor; a workflow template where the key field was bound to an empty string node output.","solutions":["Set a non-empty key, e.g. key = \"result\".","Trim intended whitespace-only keys to a real identifier.","If the key comes from a string node input, validate it is non-blank before feeding the node."],"exampleFix":"// before\nkey = \"   \"  # strips to empty\n// after\nkey = \"result\"","handlingStrategy":"validation","validationCode":"key = raw_key.strip()\nif not key:\n    raise ValueError(\"Workflow return key must not be empty.\")","typeGuard":null,"tryCatchPattern":"try:\n    out = invocation.invoke(context)\nexcept ValueError as e:\n    if \"key must not be empty\" in str(e):\n        key = \"result\"  # substitute a default key\n    else:\n        raise","preventionTips":["Always set an explicit, non-empty key on Workflow Return nodes.","Strip user-supplied keys and reject blanks before invoking.","Avoid binding the key field to outputs that may be empty strings."],"tags":["validation","workflow","empty-string"],"backgroundTag":"missing-required-field","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}