ديـرDeerالدليلDocs

الأخطاء والموافقات

الأخطاء التي قد يتسلمها عميل MCP أو عميل الواجهة العامة، وكيف تجري الموافقة من أولها إلى آخرها، وكيف تعيد المحاولة بأمان.

ثلاثة أنواع من الأخطـاء

قد يُرفض طلب العميل على ثلاثة مستويات، فافحصها بهذا الترتيب.

المستوىمتىالشكل
HTTPلم يصل الطلب إلى أي أداة: رمز مفقود، أو مصدر غير مسموح، أو طلبات كثيرة.رمز حالة غير 200 مع { "ok": false, "code": "..." }.
JSON-RPCرسالة MCP نفسها خاطئة: طريقة غير معروفة، أو أداة غير معروفة، أو كائن مدخلات غير صالح.error من JSON-RPC فيه code رقمي وmessage.
الأداةفحصت الأداة الطلب فرفضته، أو فشل الإجراء.result عادي فيه isError: true وكائن JSON يحمل code.

الرموز نصوص ثابتة موجهة للبرامج. ولا يعيد دير في الأخطاء أي ردود من مزوّدين أو تفاصيل داخلية.

أخطـاء HTTP

JSON
{"ok":false,"code":"MCP_CREDENTIAL_REQUIRED"}
الحالةالرمزالمعنى والحل
400INVALID_INPUTجسم الطلب ليس JSON صالحاً، أو لم تجتز مدخلات الإجراء العام التحقق.
400MCP_VERSION_UNSUPPORTEDتذكر الترويسة MCP-Protocol-Version إصداراً لا يدعمه دير.
400JSON-RPC -32600الجسم ليس رسالة JSON-RPC 2.0 واحدة، وهنا تُرفض الرسائل المجمّعة.
401MCP_CREDENTIAL_REQUIREDالرمز مفقود أو مشوّه أو ملغى أو يخص مساحة عمل أخرى، أو فقد صاحبه الوصول إلى MCP، أو أن MCP غير متاح في مساحة العمل. ويتضمن الرد WWW-Authenticate: Bearer.
403ORIGIN_REJECTEDجاء طلب MCP من صفحة ويب في موقع آخر.
403ORIGIN_NOT_ALLOWEDجاء طلب POST إلى الإجراءات العامة من موقع غير مواقع دير.
405لا يوجدطلب GET أو DELETE إلى عنوان MCP. استخدم POST.
413MCP_REQUEST_TOO_LARGEتجاوز طلب MCP حد 15,029,592 بايت. يعيد JSON-RPC الخطأ -32600 والحد في data.limit.
413REQUEST_FAILEDتجاوز طلب الإجراء العام 2 KB.
429REQUEST_FAILEDطلبات كثيرة. انتظر قبل إعادة المحاولة.
500REQUEST_FAILEDخطأ غير متوقع في الخادم. أعد المحاولة لاحقاً.

لا يذكر الرمز 401 أي الأسباب هو. فتأكد أن الاتصال مفعّل في الإعدادات ثم MCP، وأن صاحبه ما زال عضواً في مساحة العمل ولديه وصول إلى MCP، وأنك نسخت الرمز كاملاً.

أخطـاء JSON-RPC

JSON
{"jsonrpc":"2.0","id":4,"error":{"code":-32602,"message":"Unknown tool"}}
الرمزالرسالةالمعنى
-32601Method not foundيدعم دير initialize وping وtools/list وtools/call.
-32602Invalid initializationينقص initialize أحدُ الحقول protocolVersion أو capabilities أو clientInfo.
-32602Invalid tool requestتحتاج معاملات tools/call إلى name، وإلى كائن arguments إن وُجدت مدخلات.
-32602Unknown toolالاسم ليس من أدوات MCP.
-32602Invalid approval IDقيمة _moeen_approval ليست UUID، أو أُرسلت إلى أداة لا تحتاج إلى موافقة أصلاً.

أخطاء الأدوات

إذا رفضت الأداة الطلب، حمل محتواها النصي كائناً فيه code:

JSON
{"jsonrpc":"2.0","id":5,"result":{"content":[{"type":"text","text":"{\"code\":\"RECORD_UNAVAILABLE\"}"}],"isError":true}}
الرمزالمعنى والحل
INVALID_INPUTالمدخلات لا تطابق مخطط الأداة، والحقول غير المعروفة مرفوضة. قارنها بما يعيده tools/list.
MCP_PERMISSION_REQUIREDصلاحية الاتصال أو صلاحية صاحبه الحالية لا تسمح بهذه الأداة.
MCP_APPROVAL_REQUIREDإذا جاء معه approvalId فيجب أن يوافق شخص أولاً. وإذا جاء دونه عند إعادة المحاولة، فرقم الموافقة غير معروف، أو مرفوض، أو منتهٍ، أو مستخدم من قبل، أو يخص مدخلات أخرى.
MCP_TOO_MANY_APPROVALSلدى الاتصال 20 طلب موافقة مفتوحاً. انتظر القرار فيها أو انتهاء صلاحيتها.
RECORD_UNAVAILABLEالمهمة غير موجودة، أو أرسلت رمز العرض بدلاً من id المهمة.
PROJECT_UNAVAILABLEالفريق غير موجود أو لا تستطيع فتحه.
PROJECT_ARCHIVEDالفريق مؤرشف، فلا تُضاف إليه مهام.
ASSIGNEE_UNAVAILABLEأحد معرّفات الأشخاص ليس لعضو في مساحة العمل.
TASK_DEPENDENCY_CYCLEالمهام المعيقة ستجعل مهمة تعيق نفسها.
SUBTASK_UNAVAILABLEلا توجد مهمة فرعية في هذا الموضع index.
CHANNEL_UNAVAILABLEقناة التعليقات غير مرتبطة بفريق المهمة أو غير متاحة لك.
FILE_TOO_LARGEتجاوزت مرفقات التعليق الحد المسموح في العدد أو الحجم.
MODULE_DISABLEDوحدة المهام معطّلة في مساحة العمل هذه.
MCP_TOOL_FAILEDخطأ غير متوقع أثناء تشغيل الأداة.

وإذا كان دور صاحب الاتصال لا يملك صلاحية الأداة أصلاً، حمل الكائن رسالة بالعربية والإنجليزية أيضاً: {"ok":false,"message":{...},"code":"MCP_PERMISSION_REQUIRED"}.

وبعد أن تجتاز المدخلات التحقق، يُسجَّل كل رفض في سجل التدقيق بالحالة denied أو failed، ويظهر العميل منفّذاً.

إذا أعادت الأداة IDEMPOTENCY_CONFLICT، فقد استُخدم مفتاح إعادة المحاولة نفسه بمدخلات مختلفة. استخدم مفتاحاً جديداً لتعديل جديد. راجع إعادة المحاولة.

طلب الموافقـة

إذا طلب منفّذ غير بشري إجراءً من نوع حذف أو خارجي، توقف الإجراء حتى يقرر شخص. وفي MCP ينطبق هذا على tasks.delete.

  1. يستدعي العميل الأداة

    يرسل العميل tasks.delete ومعه معرّف المهمة. فيتحقق دير من الاتصال ومن صلاحية صاحبه ومن أن المهمة ظاهرة له.

  2. يحفظ دير طلب موافقة

    لا يُحذف شيء. تحمل النتيجة isError: true والرمز MCP_APPROVAL_REQUIRED ورقم الموافقة في approvalId، ويسجّل سجل التدقيق الحالة pending-approval.

  3. يُعلم العميل المستخدم

    أخبر المستخدم أن الطلب ينتظر في دير، ولا تكرر الاستدعاء في حلقة، فتكراره يعيد approvalId نفسه.

  4. يقرر شخص

    يفتح صاحب الاتصال الإعدادات ثم MCP، ويختار السماح بالحذف أو رفض تحت طلبات الموافقة. ويجب أن يملك صلاحية تعديل المهام. وإذا تغيّرت المهمة بعد الطلب، رفض دير الموافقة عليه.

  5. يعيد العميل المحاولة مرة واحدة

    خلال 15 دقيقة من الاستدعاء الأول، يكرر العميل الاستدعاء بالمدخلات نفسها ويضيف _moeen_approval. فيتحقق دير من الموافقة والمدخلات ونسخة المهمة، ثم ينفّذ الإجراء ويُعلِّم الموافقة مستخدَمة.

تجد الطلب والرد كاملين في أدوات MCP. ويطبّق AI القاعدة نفسها في المحادثات، حيث يوافق صاحب الطلب على الإجراء المقترح. راجع الموافقات.

إعادة المحاولة ومنع التكـرار

  • حدود المعدل. إذا تسلمت 429 فتمهّل ثم أعد المحاولة لاحقاً، ووزّع طلباتك بدلاً من إرسالها دفعة واحدة.
  • أخطاء الخادم. إذا تسلمت 500 أو MCP_TOOL_FAILED فأعد المحاولة لاحقاً بفواصل متزايدة، بعد أن تتأكد أن التعديل لم ينجح من قبل.
  • التحقق والصلاحيات. لا تعد المحاولة كما هي بعد INVALID_INPUT أو MCP_PERMISSION_REQUIRED أو 401. أصلح المدخلات أو الصلاحية أو الرمز أولاً.
  • إعادة محاولة التعديل عبر MCP. إذا قبلت الأداة _moeen_idempotency_key، أعد إرسال المفتاح والمدخلات نفسهما خلال 24 ساعة. إذا أرسلت الاستدعاء الأول دون مفتاح، فتحقّق مما حدث قبل إعادته.
  • بعض التعديلات آمنة التكرار. tasks.set_status وtasks.assign وtasks.set_subtask وtasks.update تضبط قيمة محددة، فتكرار الاستدعاء نفسه يترك النتيجة نفسها.
  • الحذف مرة واحدة. رقم الموافقة لا يُستخدم إلا مرة، فلا يمكن أن يحذف التكرار مرتين.

وترسل واجهة دير مفتاح منع تكرار مع كل تعديل. فإذا تكرر الطلب بالمفتاح والمدخلات نفسها أُعيدت النتيجة الأولى، وإذا جاء المفتاح نفسه بمدخلات مختلفة رُفض بالرمز IDEMPOTENCY_CONFLICT. راجع منع التكرار.

والعمل الذي يخرج من دير، كإرسال البريد أو تشغيل أداة تطبيق، لا يُعاد تلقائياً أبداً إذا لم تتأكد نتيجته، بل يُعلِّمه دير ليتحقق منه شخص في التطبيق المعني.

Errors and approvals

The errors an MCP or public API client can receive, how the approval flow works end to end, and how to retry safely.

Three kinds of error

A client can be refused at three levels. Check them in this order.

LevelWhenShape
HTTPThe request never reached a tool: missing token, wrong origin, too many requests.A non-200 status with { "ok": false, "code": "..." }.
JSON-RPCThe MCP message itself is wrong: unknown method, unknown tool, bad arguments object.A JSON-RPC error with a numeric code and a message.
ToolThe tool ran its checks and refused, or the action failed.A normal result with isError: true and a JSON object holding a code.

Codes are stable strings meant for programs. Deer never returns provider responses or internal details in an error.

HTTP errors

JSON
{"ok":false,"code":"MCP_CREDENTIAL_REQUIRED"}
StatusCodeMeaning and fix
400INVALID_INPUTThe body is not valid JSON, or a public action input failed validation.
400MCP_VERSION_UNSUPPORTEDThe MCP-Protocol-Version header names a version Deer does not support.
400JSON-RPC -32600The body is not a single JSON-RPC 2.0 message. Batches are refused here.
401MCP_CREDENTIAL_REQUIREDThe token is missing, malformed, revoked or for another workspace, its owner no longer has MCP access, or MCP is unavailable in the workspace. The response includes WWW-Authenticate: Bearer.
403ORIGIN_REJECTEDAn MCP request came from a web page on another site.
403ORIGIN_NOT_ALLOWEDA public action POST came from a site other than Deer's.
405noneGET or DELETE on the MCP endpoint. Use POST.
413MCP_REQUEST_TOO_LARGEThe MCP body exceeds 15,029,592 bytes. The JSON-RPC error is -32600 and data.limit gives the limit.
413REQUEST_FAILEDThe public action body exceeds 2 KB.
429REQUEST_FAILEDToo many requests. Wait before retrying.
500REQUEST_FAILEDAn unexpected server error. Retry later.

A 401 does not say which of the reasons applies. Check that the connection is Active in Settings, MCP, that its owner is still a workspace member with MCP access, and that you copied the whole token.

JSON-RPC errors

JSON
{"jsonrpc":"2.0","id":4,"error":{"code":-32602,"message":"Unknown tool"}}
CodeMessageMeaning
-32601Method not foundDeer supports initialize, ping, tools/list and tools/call.
-32602Invalid initializationinitialize is missing protocolVersion, capabilities or clientInfo.
-32602Invalid tool requesttools/call params need a name and, optionally, an arguments object.
-32602Unknown toolThe name is not one of the MCP tools.
-32602Invalid approval ID_moeen_approval is not a UUID, or was sent to a tool that never needs approval.

Tool errors

When a tool refuses, the text content holds an object with a code:

JSON
{"jsonrpc":"2.0","id":5,"result":{"content":[{"type":"text","text":"{\"code\":\"RECORD_UNAVAILABLE\"}"}],"isError":true}}
CodeMeaning and fix
INVALID_INPUTThe arguments do not match the tool's schema. Unknown fields are refused. Compare with tools/list.
MCP_PERMISSION_REQUIREDThe connection's scope or its owner's current permission does not allow this tool.
MCP_APPROVAL_REQUIREDWith an approvalId: a person must approve first. Without one, on a retry: the approval id is unknown, rejected, expired, already used or for different arguments.
MCP_TOO_MANY_APPROVALSThe connection already has 20 open approval requests. Wait for decisions or expiry.
RECORD_UNAVAILABLEThe task does not exist, or the id is a display key instead of the task id.
PROJECT_UNAVAILABLEThe team does not exist or you cannot open it.
PROJECT_ARCHIVEDThe team is archived, so tasks cannot be added to it.
ASSIGNEE_UNAVAILABLEA person id is not a member of the workspace.
TASK_DEPENDENCY_CYCLEThe blockers would make a task block itself.
SUBTASK_UNAVAILABLEThere is no subtask at that index.
CHANNEL_UNAVAILABLEA comment channel is not linked to the task's team or is not open to you.
FILE_TOO_LARGEComment attachments exceed the count or size limit.
MODULE_DISABLEDTasks is turned off for this workspace.
MCP_TOOL_FAILEDAn unexpected error while running the tool.

If the owner's role lacks the tool's scope entirely, the object also carries a bilingual message: {"ok":false,"message":{...},"code":"MCP_PERMISSION_REQUIRED"}.

Once the input passes validation, every refusal is written to the audit log with the status denied or failed, and the client as the actor.

If a tool returns IDEMPOTENCY_CONFLICT, the same retry key was used with different arguments. Use a new key for a new write. See Retry a write.

Approval required

Destructive and External actions requested by a non-human actor stop for a person. Over MCP this applies to tasks.delete.

  1. The client calls the tool

    The client sends tasks.delete with a task id. Deer checks the connection, the owner's permission and that the task is visible to the owner.

  2. Deer stores an approval request

    Nothing is deleted. The result has isError: true, the code MCP_APPROVAL_REQUIRED and an approvalId. The audit log records pending-approval.

  3. The client tells the user

    Show the user that the request is waiting in Deer. Do not loop on the call: repeating it returns the same approvalId.

  4. A person decides

    The connection owner opens Settings, then MCP, and selects Approve deletion or Reject under Approval requests. They need permission to change tasks. If the task changed since the request, Deer refuses to approve it.

  5. The client retries once

    Within 15 minutes of the first call, the client repeats the call with the same arguments and _moeen_approval. Deer checks the approval, the arguments and the task version, runs the action and marks the approval used.

The full request and response pair is in MCP tools. AI uses the same rule in conversations, where the person who asked approves the proposed action. See Approvals.

Retries and idempotency

  • Rate limits. On 429, back off and retry later. Spread requests rather than sending bursts.
  • Server errors. On 500 or MCP_TOOL_FAILED, retry later with increasing delays, after checking that a write did not already succeed.
  • Validation and permission. Do not retry INVALID_INPUT, MCP_PERMISSION_REQUIRED or a 401 unchanged. Fix the input, the scope or the token first.
  • Retrying an MCP write. If the tool accepts _moeen_idempotency_key, repeat the call with the same key and arguments within 24 hours. If the first call had no key, check whether the change happened before sending it again.
  • Some writes are safe to repeat. tasks.set_status, tasks.assign, tasks.set_subtask and tasks.update set a value, so repeating the same call leaves the same result.
  • Deletion runs once. An approval id can be used once, so a repeated retry cannot delete twice.

The Deer interface sends an idempotency key with every write. A repeat with the same key and input returns the first result, and the same key with different input is refused with IDEMPOTENCY_CONFLICT. See Idempotency.

Work that leaves Deer, such as sending mail or running an app tool, is never retried automatically after an uncertain outcome. Deer marks it for a person to check in the app concerned.