iflytek/astron-agent · error · CustomException
APP_NOT_FOUND_ERROR
APP_NOT_FOUND_ERROR
Error message
App not found for nested workflow execution: {self.appId} What it means
The flow node looks up the target app (nested workflow) by appId in the database before calling its API. When the query returns None or an app with id==0 the node raises APP_NOT_FOUND_ERROR, because it cannot obtain the api_key/api_secret needed to authorize the nested call.
Solutions
- Verify the appId configured on the flow node exists in the target environment's app table
- Re-select the nested workflow app in the flow node editor and re-save the node
- Check tenant/space isolation — the app must belong to a space the executing user can access
- Restore or republish the app if it was deleted or unpublished
Example fix
// before appId = "wf_12345" // deleted app // after appId = "wf_67890" // re-selected published nested workflow app
Defensive patterns
Strategy: validation
Validate before calling
app = app_repository.get_by_id(flow_node.appId)
if app is None or app.id == 0:
raise ConfigError(f'flow node references missing app {flow_node.appId}') Type guard
def app_exists(app) -> bool:
return app is not None and getattr(app, 'id', 0) != 0 Try / catch
try:
outputs = await flow_node.async_execute(ctx)
except CustomException as e:
if e.err_code == CodeEnum.APP_NOT_FOUND_ERROR:
notify_owner(f'app {flow_node.appId} missing; republish or rebind node')
raise Prevention
- Verify appId after copying workflows between environments
- Never delete apps still referenced by other workflows; check references first
- Re-select the nested workflow in the editor after any app migration
When it happens
Trigger: _assemble_request fetches the app for self.appId and gets no row (or a placeholder id=0), typically right after the 'flow_node_get_appid_from_database' timing log.
Common situations: Nested workflow's app was deleted or unpublished; appId copied from another environment/tenant; typo in app configuration; database replication lag in multi-region setups.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/ffeb8656449e0d47.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/engine/nodes/flow/flow_node.py:395
"req_body": json.dumps(req_body, ensure_ascii=False),
}
)
# Query application credentials from database
with session_getter() as session:
start_time = time.time() * 1000
app = session.query(App).filter_by(alias_id=self.appId).first()
# Log database query performance
await span.add_info_events_async(
{
"flow_node_get_appid_from_database": f"{time.time() * 1000 - start_time}"
}
)
# Validate app existence
if not app or app.id == 0:
raise CustomException(
err_code=CodeEnum.APP_NOT_FOUND_ERROR,
err_msg=f"App not found for nested workflow execution: {self.appId}",
)
# Construct authorization header
authorization = f"Bearer {app.api_key}:{app.api_secret}"
# Set authentication headers based on runtime environment
if not os.getenv("RUNTIME_ENV", RuntimeEnv.Local.value) in [
RuntimeEnv.Dev.value,
RuntimeEnv.Test.value,
]:
# Use bearer token for production environments
headers["Authorization"] = authorization
else:
# Development/test calls use a trusted identity only when the same
# deployment-internal credential is present.
internal_api_key = credential_from_env_or_file(View on GitHub (pinned to 5e758547a8)