langgenius/dify · error · NotFound
Conversation Not Exists.
Error message
Conversation Not Exists.
What it means
Raised by CompletionApi.post as a werkzeug NotFound (HTTP 404) when AppGenerateService.generate raises services.errors.conversation.ConversationNotExistsError. For completion (text-generation) apps this is rare because CompletionMessageExplorePayload carries no conversation_id, but the shared generate service can still reference a conversation in edge cases (e.g., a persisted query referencing a stale conversation). The controller translates the service-layer error into a 404.
Source
Thrown at api/controllers/console/explore/completion.py:127
args["auto_generate_name"] = False
installed_app.last_used_at = naive_utc_now()
db.session.commit()
try:
response = AppGenerateService.generate(
session=session,
app_model=app_model,
user=current_user,
args=args,
invoke_from=InvokeFrom.EXPLORE,
streaming=streaming,
)
# response-contract:ignore compact_generate_response
return helper.compact_generate_response(response)
except services.errors.conversation.ConversationNotExistsError:
raise NotFound("Conversation Not Exists.")
except services.errors.conversation.ConversationCompletedError:
raise ConversationCompletedError()
except services.errors.app_model_config.AppModelConfigBrokenError:
logger.exception("App model config broken.")
raise AppUnavailableError()
except ProviderTokenNotInitError as ex:
raise ProviderNotInitializeError(ex.description)
except QuotaExceededError:
raise ProviderQuotaExceededError()
except ModelCurrentlyNotSupportError:
raise ProviderModelCurrentlyNotSupportError()
except InvokeError as e:
raise CompletionRequestError(e.description)
except ValueError as e:
raise e
except Exception:
logger.exception("internal server error.")
raise InternalServerError()View on GitHub (pinned to ef8544b173)
Solutions
- Omit any conversation_id from the request payload for completion apps — completion apps are single-turn.
- Start a fresh completion request without carrying over state from a chat session.
- If the app config embeds a conversation reference, re-publish the app in Studio.
- Verify the installed app is genuinely a completion app and not a mislabeled chat app.
Example fix
// before: forwarding chat state into a completion call
const payload = { inputs, query, conversation_id: lastConversationId }
await post('/completion-messages', payload)
// after: completion apps are stateless — drop the conversation id
const payload = { inputs, query }
await post('/completion-messages', payload) Defensive patterns
Strategy: validation
Validate before calling
// Completion apps are single-turn: strip any conversation_id before posting.
function buildCompletionPayload({ inputs, query, files }) {
// intentionally omit conversation_id
return { inputs, query, files };
} Type guard
function isStatelessCompletionPayload(payload) {
return !('conversation_id' in payload) || payload.conversation_id == null;
} Try / catch
try {
await postCompletion(id, payload);
} catch (err) {
if (err.status === 404 && /conversation not exists/i.test(err.message)) {
// drop any conversation reference and retry once
const { conversation_id, ...rest } = payload;
await postCompletion(id, rest);
} else { throw err; }
} Prevention
- Never forward chat conversation ids into completion-app requests.
- Keep completion and chat payload builders separate in client code.
- Treat a 404 'Conversation Not Exists' on a completion app as a client payload bug.
When it happens
Trigger: POST /console/installed-apps/<id>/completion-messages where the underlying generation service resolves a conversation_id (passed via args or referenced in app config) that does not exist for this app/user. Also reachable if a completion app was misconfigured to reference a conversation.
Common situations: Client reuses stale args from a previous chat session on a completion app; app config references a deleted conversation; data import/migration left dangling conversation references; a buggy client sends an extra conversation_id field.
Related errors
- conversation_completed
- Conversation Not Exists.
- Conversation not found
- Conversation Not Exists.
- Conversation Not Exists.
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/eb8d502173ecd61e.
Report an issue: GitHub.