Skip to content

TypeError: MiddlewareComponent.build() got an unexpected keyword argument 'code' #8610

@AndreasFredrich

Description

@AndreasFredrich

Bug Description

When connecting the Text Input component to a custom Policy Check middleware component, the Langflow interface throws an error during component execution.

The error message is:

css
Copy
Edit
TypeError: MiddlewareComponent.build() got an unexpected keyword argument 'code'
This happens regardless of correct parameter values (API Key, Middleware URL, User Request) and blocks any further execution in the graph.

Additionally, the input compatibility between Text Input (output: Message) and Text Field (input: str) appears to be misaligned. Connecting the two directly results in a component binding error.

Reproduction

Steps to reproduce the behavior:

Drag a Text Input component onto the canvas.

Drag a custom middleware component (like Policy Check) into the canvas.

Configure API Key, Middleware URL, and User Request.

Run the graph – observe error about unexpected keyword argument 'code'.

For the input type mismatch:

Drag Text Input and a Text Field component.

Try connecting Text Input's output to Text Field’s input.

Langflow shows a connection type mismatch error.

Expected behavior

The middleware component should accept valid arguments without throwing build() errors.

InputText (which semantically returns a str) should be connectable to any component expecting str—including Text Field.

Who can help?

Likely frontend + component system maintainers.

Possibly:
@CrihanHashir @lucascaleoli @igorrCarvalho (frontend)
@talajohny (backend)

Operating System

Windows 10 Pro (22H2)

Langflow Version

1.4.2

Python Version

3.12

Screenshot

No response

Flow File

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingjiraThis issue has been logged in Jira for fix by the engineering team.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions