MeshKit

SDK Troubleshooting

Symptom-first fixes for SDK integration issues.

Start with the error code and the provider boundary. MeshKit classifies many failures as MeshKitError with a code, message, and suggestion.

import { MeshKitError, meshkit } from "@meshkit/meshkit";

const mesh = await meshkit();

try {
  await mesh.files.get("bafk-missing-or-wrong-cid");
} catch (error) {
  if (error instanceof MeshKitError) {
    console.error(error.code);
    console.error(error.suggestion);
  }
}

Do not fix SDK issues by logging plaintext, private keys, bearer tokens, capability token secrets, or full provider responses.

Quick Triage

SymptomMost likely boundaryWhat to check first
Package cannot be importedInstall/package nameUse @meshkit/meshkit, not unscoped meshkit
Local quickstart works, production read failsProvider and metadata serviceConfirm the same MeshKit provider boundary created and reads the CID
CID exists but cannot decryptIdentity or share capsuleConfirm the current identity has a wrapped key or capsule
Share opens for owner but not recipientRecipient identityCreate, import, publish, or resolve the recipient identity
Message inbox is emptyProvider mailboxConfirm mailbox support and recipient ID
Stream resume failsResume tokenUse a token from the same direction, CID, name, chunk size, and manifest
Sync job never runsApp schedulerCall flush from a real runtime background or foreground path
Doctor fails only in CIEnvironment and secretsCheck provider tokens, env vars, network access, and secret redaction

Common Error Codes

CodeMeaningFix
invalid_configMeshKit options or config are inconsistentValidate meshkit.config.json and runtime options
invalid_cli_configCLI config cannot be parsed or usedRe-run CLI init or repair the config file
provider_http_errorProvider returned an HTTP failureCheck endpoint, credentials, request body, and sanitized response
provider_request_failedProvider request failed before a valid responseCheck network, DNS, TLS, retries, and timeout
identity_not_foundMeshKit cannot find the requested identityCreate/import identity or configure a directory
recipient_not_authorizedRecipient does not have access to the contentCreate a new share capsule or update membership
key_unwrap_failedCurrent identity cannot unwrap the content keyOpen as the right identity or verify the capsule
capsule_not_foundShare capsule ID is missing from metadataAsk sender to resend or check provider metadata
share_expiredCapsule expiry passedCreate or request a new capsule
share_revokedCapsule was revokedCreate a new share if access should resume
policy_provider_requiredOpening depends on a policy providerConfigure the provider used to create the capsule
policy_deniedPolicy provider denied accessUpdate policy membership or issue a new share
capability_requiredA capability token is requiredPass the token issued by the vault or capability owner
invalid_stream_resume_tokenResume token does not match the operationRestart or use a fresh token from the same stream
sync_not_supportedProvider cannot store sync jobsUse a provider with sync queue support

Provider And Metadata Problems

MeshKit production workflows need more than raw bytes. The provider boundary must preserve encrypted bytes and the MeshKit metadata used for proofs, capsules, mailboxes, sync jobs, vaults, capabilities, logs, and health checks.

If reads fail in production:

  1. Confirm the CID came from this MeshKit environment.
  2. Confirm the byte provider can retrieve the encrypted envelope.
  3. Confirm the metadata service has the proof and any required capsule or mailbox record.
  4. Run mesh.doctor.run() in app code or npx -p @meshkit/cli meshkit doctor --json from the terminal.
  5. Check MeshKitError.code before changing encryption or identity logic.

Identity And Sharing Problems

MeshKit identities are application-level encryption identities. They are not automatically emails, wallets, DIDs, or passkeys.

When sharing fails:

  • Verify the sender created or resolved the recipient public key before creating the capsule.
  • Open the capsule as the intended recipient with openCapsule(capsule, { as: "recipient" }).
  • Confirm the capsule is not expired or revoked.
  • If policy, vault, or capability fields are present, configure and pass those requirements.

Local Works, Production Fails

Local development defaults are intentionally forgiving. Production adds real provider boundaries:

  • Credentials can be missing or scoped incorrectly.
  • A Kubo or gateway path can store bytes but not MeshKit metadata.
  • Browser and mobile apps should not connect directly to unrestricted Kubo RPC.
  • Filecoin deal state does not guarantee immediate retrieval.
  • Mobile native vault behavior depends on the runtime bridge actually installed.

Use Production setup and Provider testing before shipping.

Safe Debug Output

Safe to log:

  • MeshKitError.code
  • MeshKitError.suggestion
  • CID
  • provider name
  • proof summary
  • capsule ID
  • sync job ID

Do not log:

  • plaintext
  • private keys
  • bearer tokens
  • capability token secrets
  • full provider response bodies that may contain credentials

Next Steps

On this page