Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom component error (Component has not been built yet) #6019

Closed
Bal1 opened this issue Jan 30, 2025 · 9 comments
Closed

Custom component error (Component has not been built yet) #6019

Bal1 opened this issue Jan 30, 2025 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@Bal1
Copy link

Bal1 commented Jan 30, 2025

Bug Description

When connecting text inputs - all is ok, but when you want connect custom component with text input - langflow thrown an error.
Need to connect 2 or more custom components, with one custom component all is ok.

Reproduction

  1. create custom component returning message
  2. clone component
  3. add text input component
  4. connect all components (custom -> custom -> text input)
  5. try to run it

Expected behavior

text input component should receive text from custom componentn

Who can help?

@italojohnny

Operating System

Docker

Langflow Version

1.1.3

Python Version

None

Screenshot

Image

Flow File

custom component error.json

@Bal1 Bal1 added the bug Something isn't working label Jan 30, 2025
Copy link

dosubot bot commented Jan 30, 2025

Hey there, @Bal1! I'm here to help you with any bugs, questions, or contributions. Feel free to ask for assistance while we wait for a human maintainer.

I found a similar solved discussion that might be relevant to your issue. The discussion titled Component Running Error addresses issues with custom components not running correctly alongside front-end components. Here are some potential causes and solutions mentioned:

  1. Name Overlap: Ensure there is no overlap between the names of inputs and outputs in your custom component.
  2. Reserved Attribute Names: Verify that your custom component does not use reserved attribute names for its inputs or outputs.
  3. Component Validation: Make sure your custom component is properly validated for compatibility with front-end components.
  4. Execution Order: Check the execution order of your components. Langflow uses a topological sort to manage execution order, so ensure that your custom component is correctly integrated into this flow.
  5. Error Logging: Utilize Langflow's logging capabilities to identify specific errors.

Review these aspects of your custom component and its integration with the text input to identify and resolve the issue [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@Bal1
Copy link
Author

Bal1 commented Jan 30, 2025

@dosu I changed component names, all component are working separatelly, but when running last element - error appears:

Image

Copy link

dosubot bot commented Jan 30, 2025

When connecting multiple custom components in Langflow, ensure that there are no overlapping names between inputs and outputs, as this can cause conflicts and errors [1]. Additionally, verify that each component is properly validated and compatible with the others. Langflow uses a Directed Acyclic Graph (DAG) to manage execution order, so ensure that your components are correctly integrated into this flow [2].

If the error persists, check the specific error messages or logs generated by Langflow. Common errors include invalid return types, type conversion issues, or problems building components [3]. These logs can provide more insight into what might be causing the issue.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@Bal1
Copy link
Author

Bal1 commented Jan 30, 2025

@dosu I changed output names also, but issue exists.

Image

Error log:

Component Component2 has not been built yet

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/langflow/api/v1/chat.py", line 242, in _build_vertex
    vertex_build_result = await graph.build_vertex(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langflow/graph/graph/base.py", line 1440, in build_vertex
    await vertex.build(
  File "/app/.venv/lib/python3.12/site-packages/langflow/graph/vertex/base.py", line 839, in build
    await step(user_id=user_id, event_manager=event_manager, **kwargs)
  File "/app/.venv/lib/python3.12/site-packages/langflow/graph/vertex/base.py", line 485, in _build
    await self._build_each_vertex_in_params_dict()
  File "/app/.venv/lib/python3.12/site-packages/langflow/graph/vertex/base.py", line 576, in _build_each_vertex_in_params_dict
    await self._build_vertex_and_update_params(
  File "/app/.venv/lib/python3.12/site-packages/langflow/graph/vertex/base.py", line 671, in _build_vertex_and_update_params
    result = await vertex.get_result(self, target_handle_name=key)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langflow/graph/vertex/base.py", line 621, in get_result
    return await self._get_result(requester, target_handle_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/langflow/graph/vertex/vertex_types.py", line 114, in _get_result
    raise ValueError(msg)
ValueError: Component Component2 has not been built yet

Copy link

dosubot bot commented Jan 30, 2025

The error message "Component Component2 has not been built yet" suggests that the component is not being executed in the correct order or is missing necessary inputs. Here are some steps to troubleshoot and resolve the issue:

  1. Check Dependencies: Ensure that all dependencies for "Component2" are correctly set up and that it receives the necessary inputs from "Component1". Verify that the connections between components are properly established.

  2. Execution Order: Langflow uses a Directed Acyclic Graph (DAG) to manage execution order. Make sure that "Component2" is correctly integrated into this flow and that there are no cycles or missing connections that could disrupt the order [1].

  3. Component Validation: Double-check that "Component2" is properly validated and compatible with the other components. Ensure that it is correctly defined and that all required parameters are set.

  4. Error Logging: Review the error logs for any additional details that might indicate what is preventing "Component2" from being built. Look for issues related to parameter handling or type mismatches.

  5. Rebuild Components: Try rebuilding the components individually using the Play button to ensure they work independently before connecting them in the flow [2].

By following these steps, you should be able to identify and resolve the issue with "Component2" not being built.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@Bal1
Copy link
Author

Bal1 commented Jan 30, 2025

@italojohnny maybe you can help with this issue?

@Cristhianzl
Copy link
Member

Cristhianzl commented Feb 3, 2025

hi @Bal1,

When you are returning a value, you have to construct the class you are returning It.
probably you have missed this step.
Look at the Custom Component code that works:

# from langflow.field_typing import Data
from langflow.custom import Component
from langflow.io import MessageTextInput, Output
from langflow.schema import Data


class CustomComponent(Component):
    display_name = "Custom Component"
    description = "Use as a template to create your own component."
    documentation: str = "http://docs.langflow.org/components/custom"
    icon = "code"
    name = "CustomComponent"

    inputs = [
        MessageTextInput(
            name="input_value",
            display_name="Input Value",
            info="This is a custom component Input",
            value="Hello, World!",
            tool_mode=True,
        ),
    ]

    outputs = [
        Output(display_name="Output", name="output", method="build_output"),
    ]

    def build_output(self) -> Message:
        return Message(
            text=self.input_value,
        )

def build_output(self) -> Message:
return Message(
text=self.input_value,
)

Image

@Bal1
Copy link
Author

Bal1 commented Feb 6, 2025

@Cristhianzl can you open an example I attached?

all custom components have a class in return method, but when you connect it to langflow component (for example text) it stop working.
just add text input to bottom line of components and you will see the error.

@Cristhianzl
Copy link
Member

Hi @Bal1,

Got it! You were absolutely right—the Vertex build wasn’t applying this rule as expected.
Please follow up on this PR with the fix: #6155.

Thanks a lot for your collaboration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants