langgenius/dify · error · AgentAppGeneratorError
Agent App has no bound Agent
Error message
Agent App has no bound Agent
What it means
Raised by get_published_agent_app_feature_dict_and_user_input_form when app_model.bound_agent_id is falsy. The Agent App model is backed by a published Agent Soul; without a bound agent there is nothing to project into app features and user input form, so generation is refused early.
Source
Thrown at api/controllers/common/agent_app_parameters.py:25
from core.app.apps.agent_app.app_feature_projection import merge_agent_app_features
from core.app.apps.agent_app.app_variable_projection import agent_app_variables_to_user_input_form
from core.app.apps.agent_app.errors import AgentAppGeneratorError, AgentAppNotPublishedError
from models.agent import Agent, AgentConfigSnapshot, AgentStatus
from models.agent_config_entities import AgentSoulConfig
from models.model import App, load_annotation_reply_config
def get_published_agent_app_feature_dict_and_user_input_form(
app_model: App,
*,
session: Session,
) -> tuple[dict[str, Any], list[dict[str, Any]]]:
"""Return public Agent App parameters backed by the published Agent Soul."""
app_model_config = app_model.app_model_config_with_session(session=session)
agent_id = app_model.bound_agent_id
if not agent_id:
raise AgentAppGeneratorError("Agent App has no bound Agent")
agent = session.scalar(
select(Agent)
.where(
Agent.tenant_id == app_model.tenant_id,
Agent.id == agent_id,
Agent.status == AgentStatus.ACTIVE,
)
.limit(1)
)
if agent is None:
raise AgentAppGeneratorError("Agent App has no bound Agent")
if not agent_has_workflow_callable_active_snapshot(session=session, agent=agent):
raise AgentAppNotPublishedError("Agent has not been published")
snapshot = session.scalar(
select(AgentConfigSnapshot)
.where(View on GitHub (pinned to ef8544b173)
Solutions
- Bind an Agent to the App (set bound_agent_id) via the agent app management API.
- If the agent was deleted, re-create it and rebind, or convert the app mode.
- Check the apps table row for the app_id to confirm bound_agent_id is populated.
Example fix
// before // app.bound_agent_id is NULL // after // bind an agent (via the management endpoint or ORM): app.bound_agent_id = agent.id session.commit()
Defensive patterns
Strategy: type-guard
Validate before calling
def app_has_bound_agent(app_model) -> bool:
return bool(getattr(app_model, 'bound_agent_id', None)) Type guard
def app_has_bound_agent(app_model) -> bool:
return bool(getattr(app_model, 'bound_agent_id', None)) Try / catch
from controllers.common.agent_app_parameters import get_published_agent_app_feature_dict_and_user_input_form
from core.app.apps.agent_app.errors import AgentAppGeneratorError
try:
features, form = get_published_agent_app_feature_dict_and_user_input_form(app_model, session=session)
except AgentAppGeneratorError:
# surface a user-facing 'app not configured' message
raise Prevention
- Always bind an Agent before publishing an agent-app.
- Clear bound_agent_id when an agent is deleted to keep state consistent.
- Add a DB constraint / app-layer invariant that agent-app mode requires a binding.
When it happens
Trigger: Requesting the published parameters of an App whose mode is agent-app but whose bound_agent_id column is null/empty — e.g. an app created before the agent binding was set, or a stale app record.
Common situations: Migrating legacy apps that predate Agent Soul, deleting the bound agent without clearing the app, or a race where the app was created but the binding transaction did not commit.
Related errors
- Agent published version not found
- Workspace owner not found for tenant={current_tenant_id}
- Unsupported legacy dataset permission: {permission}
- Dataset Collection Binding not found
- remote configs is not dict, but {type(self.remote_configs)}
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/3d861163a55ce73b.
Report an issue: GitHub.