agentleFS
CUSTOM-DOMAIN-APPCUSTOM-DOMAIN-APP/customdomain-mcp/skills/debug-failed-connection/SKILL.md

debug-failed-connection

Skill1 starsChanged 20 days agoMITView on GitHub

Debug a customer's CustomDomain™ connection that is stuck pending, propagating or failed, or a widget that will not open, using the REST API and the widget's error codes. Use when a customer's domain will not go live, the widget shows an error, minting a widget token returns 401, 403 or 503, or someone asks why a connection failed.

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Look at status, error_code and error_message.

    line 21
  2. Distinctive:

    Never rotate the client secret of an application made in the console.

    line 67
  3. Very specific:

    Check the webhook delivery log with GET /v1/webhook-deliveries and the setup-webhooks skill.

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Debug a failed connection

For a developer whose product embeds the widget. If the customdomain MCP server is connected and the person works with their own domains, the fix-a-domain skill is the shorter path.

Docs: https://docs.customdomain.ai/docs/troubleshooting

API calls use the key from the environment ($CUSTOMDOMAIN_API_KEY). Never ask the person to paste a key into the chat, and never print it.

1. Read what the connection says

curl https://api.customdomain.ai/v1/connections/<CONNECTION_ID> \
  -H "Authorization: Bearer $CUSTOMDOMAIN_API_KEY"

Look at status, error_code and error_message. The same diagnosis is on every list and on webhook events. To find the id, list connections or read it from the onSuccess, webhook or database record your product kept.

StatusMeaning
pendingThe records are not in public DNS yet. There is no deadline; the check keeps going.
propagatingRecords were written and are being watched. It becomes failed if they never resolve within 24 hours.
liveDone.
failedNot final. Records added later bring it back.

2. See what public DNS shows

curl https://api.customdomain.ai/v1/connections/<CONNECTION_ID>/diagnose \
  -H "Authorization: Bearer $CUSTOMDOMAIN_API_KEY"

Each record is reported with what public DNS has. After the customer fixes something, recheck now instead of waiting:

curl -X POST https://api.customdomain.ai/v1/connections/<CONNECTION_ID>:recheck \
  -H "Authorization: Bearer $CUSTOMDOMAIN_API_KEY"

3. Common causes of a connection that never goes live

  • The full hostname was typed into the Name field. Most DNS panels add the domain themselves, so only www (or @ for the root) belongs there.
  • A proxy is on at the DNS provider (Cloudflare's orange cloud). Switch the row to DNS only.
  • An old A or AAAA record is still at the same name.
  • A conflicting record sits at the same name, or a CAA record does not allow Let's Encrypt.
  • The records were added at the wrong place. They belong at the provider that serves the domain's nameservers, which is not always the registrar.
  • A root domain on a provider with no alias record type needs A records rather than a CNAME. Use exactly the records the connection shows.
  • The name belongs to a hosting platform's own subdomain, which cannot be connected.

4. Errors when minting a widget token

You seeLikely cause
401 unknown application or secretAn API key was sent as client_secret. Send the key as the bearer instead.
401 unauthorizedThe key is missing, revoked or wrong.
403 no_application or 403 forbiddenThe key's workspace has no application, or the application ID belongs to another workspace.
503 no_widget_credentialsThe application was not created in the console. Mint with its client secret.
404The application_id is not an application of the key's workspace.
402 billing_requiredCreating a new key needs a card on file. An owner or admin adds one under Billing.
403 token_wrong_end_userThe token's end_user_ref does not match the customer who owns the connection. Mint with the same end_user_ref and the domain it is for.
500 or 502A service side failure. Retry shortly, then contact support.

Never rotate the client secret of an application made in the console; the console keeps its own copy.

5. Errors inside the widget

  • SessionError: the token expired or was refused, including a domain bound token used for another host. Pass getToken, and when the request carries a domain, mint the new token for it.
  • PopupBlockedError: the browser blocked a sign in window. Open it from a direct click.
  • RateLimitError or an onError status of 429 or 5xx: retry after a moment.
  • PlanLimitError: the plan or allowance does not allow another connection.
  • DomainAlreadyConnectedError: another connection already serves that name.
  • UnregisteredDomainError and PlatformSubdomainError: the name cannot be connected as typed.

The list of codes is open. Branch on the ones you handle and treat the rest as a generic failure. Reference: https://docs.customdomain.ai/docs/widget-sdk/reference

6. Widget works but nothing arrives

  • Check the webhook delivery log with GET /v1/webhook-deliveries and the setup-webhooks skill.
  • A Sandbox application's events go only to the Sandbox application's own endpoints.

Report back

Say in plain words: what state the connection is in, the one most likely cause, what the customer or the team does next, and what you did not check.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.