Troubleshooting Guide
Common issues and solutions when working with Pubky.
PKARR & Discovery Issues
Section titled “PKARR & Discovery Issues”PKARR Record Not Resolving
Section titled “PKARR Record Not Resolving”Symptom: A user public key does not resolve, so apps cannot find that user’s Homeserver.
A user’s PKARR record is published under the user’s own public key. The record contains a _pubky pointer whose target is the Homeserver public key. So signer.pkdns.publishHomeserverForce(homeserverPk) signs and publishes the record for signer.publicKey; homeserverPk is the value stored in that record, not the DHT key being published.
Common Causes:
-
User Record Not Published or Points to the Wrong Homeserver
Terminal window # Verify the user's record exists on the DHTcurl -fsI https://pkarr.pubky.app/<your-public-key> >/dev/null && echo "on DHT" || echo "NOT on DHT"Solution: Explicitly publish the user’s
_pubkyHomeserver pointer. Signup normally does this for you; use force publish when setting the pointer manually, repairing a wrong or missing pointer, or migrating to a different Homeserver. Force publish means “write this pointer now”, even if the existing record is still fresh:await signer.pkdns.publishHomeserverForce(homeserverPk); -
Record Expired (TTL)
- PKARR records need periodic refresh to stay easy to discover
- Solution: Use stale-aware publishing for routine maintenance. It checks the existing record age first and no-ops while the record is fresh, then republishes once the SDK considers it stale (default: older than 1 hour). Pass
homeserverPkwhen you need missing records to be recreated; omitting it can only reuse a Homeserver target found in the existing record.
// Periodically check whether the record is stale before republishingsetInterval(async () => {await signer.pkdns.publishHomeserverIfStale(homeserverPk);},2 * 60 * 60 * 1000,); // Every 2 hours -
DHT Propagation Delay
- Records take time to propagate (usually < 5 minutes)
- Solution: Wait a few minutes after publishing, then retry
-
Incorrect Public Key Format
- Public keys must be z-base-32 encoded
- Solution: Verify key format matches:
z4e8s17cou9qmuwen8p1556jzhf1wktmzo6ijsfnri9c4hnrdfty
Debugging Commands:
# Check if PKARR relay has your recordcurl "https://pkarr.pubky.org/<public-key>"
# Check DNS resolution via PKDNSdig @pkdns.pkarr.org <public-key>
# Test with Pubky CLIpubky-cli tools verify-pkarr <public-key>Homeserver Connection Issues
Section titled “Homeserver Connection Issues”Can’t Connect to Homeserver
Section titled “Can’t Connect to Homeserver”Symptom: SDK operations fail, timeout, or refuse connection
Common Causes:
-
HTTPS Not Configured
- Homeservers REQUIRE HTTPS (not HTTP)
- Solution: Configure TLS certificate:
Terminal window # Using Let's Encryptcertbot --nginx -d yourdomain.com -
Firewall Blocking Ports
- Default ports: 6287 (user API), 6288 (admin API)
- Solution: Open firewall ports:
Terminal window # UFW examplesudo ufw allow 6287/tcpsudo ufw allow 6288/tcp -
Homeserver Not Running
- Solution: Verify Homeserver is running:
Terminal window # Check processps aux | grep pubky-homeserver# Check logsjournalctl -u pubky-homeserver -f -
PKDNS Resolution Failure
- Browser can’t resolve public-key domain
- Solution: Use PKDNS-enabled resolver or DoH:
// In browser, use full HTTPS URLconst url = `https://your-homeserver.com/pub/...`;
Test Connection:
# Direct testcurl https://your-homeserver.com/
# Via public key (requires PKDNS)curl $(pkdns resolve <public-key>)/SDK Authentication Problems
Section titled “SDK Authentication Problems”See Authentication for how Pubky authentication works.
”Invalid Signature” or “Authentication Failed”
Section titled “”Invalid Signature” or “Authentication Failed””Symptom: SDK operations rejected with authentication errors
Common Causes:
-
Recovery File Corrupted
- File is damaged or incorrectly decrypted
- Solution: Restore from backup or regenerate keys
-
Wrong Passphrase
- Recovery file passphrase is incorrect
- Solution: Verify passphrase, use correct one
-
Session Expired
- Sessions have TTL (typically 24 hours)
- Solution: Sign in again:
const session = await signer.signin(); -
Clock Skew
- System time is significantly wrong
- Solution: Sync system clock:
Terminal window # Linux/macOSsudo ntpdate -s time.nist.gov# Or use NTP servicesudo systemctl restart systemd-timesyncd
Debug Authentication:
// Force re-authenticationawait session.signout();const newSession = await signer.signin();Pubky Docker Setup Issues
Section titled “Pubky Docker Setup Issues”Containers Won’t Start
Section titled “Containers Won’t Start”Symptom: docker compose up fails or containers crash
Common Causes:
-
Port Conflicts
- Another service using required ports
- Solution: Check and free ports:
Terminal window # Find what's using portssudo lsof -i :4173 # Homeserversudo lsof -i :6881 # PKARR relaysudo lsof -i :8000 # Nexus# Kill conflicting process or change ports in .env -
Insufficient Resources
- Docker doesn’t have enough memory/CPU
- Solution: Increase Docker resources:
- Docker Desktop → Settings → Resources → Memory: 8GB+
-
Environment Variables Missing
.envfile not configured- Solution: Copy and configure:
Terminal window cp .env.example .env# Edit .env with your settings -
Volume Permission Issues
- Docker can’t write to volumes
- Solution: Fix permissions:
Terminal window sudo chown -R $USER:$USER ./data
Debug Docker:
# View logsdocker compose logs -f
# Check container statusdocker compose ps
# Restart servicesdocker compose restart
# Full resetdocker compose down -vdocker compose up -dDatabase Connection Errors
Section titled “Database Connection Errors”Symptom: Nexus or Homeserver can’t connect to Postgres/Neo4j
Solution:
# Check database containers are runningdocker compose ps postgres neo4j redis
# Restart database servicesdocker compose restart postgres neo4j redis
# Check database logsdocker compose logs postgresdocker compose logs neo4jData Operations Issues
Section titled “Data Operations Issues”PUT/DELETE Operations Fail
Section titled “PUT/DELETE Operations Fail”Symptom: Can’t store or delete data on Homeserver
Common Causes:
-
Invalid Path
- Path must start with
/pub/for public data - Solution: Use correct path format:
await session.storage.putText("/pub/myapp/data.json", data);// Invalid paths:// - "data.json"// - "/myapp/data.json" - Path must start with
-
Data Too Large
- Homeserver has size limits (default: ~10MB per file)
- Solution: Split large data or increase Homeserver limit
-
Rate Limiting
- Too many requests in short time
- Solution: Implement backoff:
async function putWithRetry(session: Session,path: Path,data: string,retries = 3,): Promise<void> {for (let i = 0; i < retries; i++) {try {return await session.storage.putText(path, data);} catch (error) {if (statusCodeOf(error) === 429) {await new Promise((resolve) => setTimeout(resolve, 1000 * (i + 1)));continue;}throw error;}}throw new Error("PUT failed after retrying rate limits");} -
Insufficient Permissions
- Trying to write to another user’s space
- Solution: Verify you’re writing to your own pubky
Pubky Ring Issues
Section titled “Pubky Ring Issues”Can’t Create Identity
Section titled “Can’t Create Identity”Symptom: Key generation fails in Pubky Ring app
Solutions:
- Update the app: Check for latest version
- Clear app cache: Settings → Storage → Clear Cache
- Reinstall: Uninstall and reinstall (backup recovery phrase first!)
App Authorization Fails
Section titled “App Authorization Fails”Symptom: Pubky Ring doesn’t authorize app requests
Solutions:
- Check app URL: Ensure correct app origin
- Re-scan QR code: Try authorization flow again
- Check Ring permissions: Ensure app has necessary permissions
Network & Performance Issues
Section titled “Network & Performance Issues”Slow PKARR Lookups
Section titled “Slow PKARR Lookups”Symptom: Discovery takes a long time
Solutions:
-
Use PKARR relay: Faster than direct DHT:
const client = new Client({pkarr: {relays: ["https://pkarr.pubky.org"],},});const pubky = Pubky.withClient(client); -
Cache aggressively: Store resolved Homeserver public keys:
async function getCachedHomeserver(pubky: Pubky,userPublicKey: string,): Promise<PublicKey | undefined> {const cached = homeserverCache.get(userPublicKey);if (cached) return cached;const user = PublicKey.from(userPublicKey);const homeserver = await pubky.getHomeserverOf(user);if (homeserver) {homeserverCache.set(userPublicKey, homeserver);}return homeserver;} -
Use local PKDNS: Run your own PKDNS server for faster resolution
High Latency Requests
Section titled “High Latency Requests”Symptom: Homeserver operations are slow
Solutions:
- Choose geographically close Homeserver
- Check Homeserver load: May be overloaded
- Use CDN: Cache static data
- Optimize request batching: Group operations
Common Error Messages
Section titled “Common Error Messages””Failed to fetch PKARR record”
Section titled “”Failed to fetch PKARR record””Causes: DHT unreachable, record doesn’t exist, network issues
Solutions:
- Check internet connection
- Verify record was published
- Try different PKARR relay
- Wait for DHT propagation
”Homeserver not found”
Section titled “”Homeserver not found””Causes: PKARR record has no Homeserver entries, DNS resolution failed
Solutions:
- Verify PKARR record contains Homeserver URL
- Check PKDNS is working
- Test direct Homeserver URL access
”Session expired”
Section titled “”Session expired””Causes: Auth session TTL passed
Solutions:
- Sign in again
- Implement automatic re-authentication
”Permission denied”
Section titled “”Permission denied””Causes: Trying to access/modify unauthorized data
Solutions:
- Check capability tokens
- Verify you own the data
- Request proper permissions
Getting Help
Section titled “Getting Help”Community Support
Section titled “Community Support”- Telegram: t.me/pubkycore
- GitHub Issues: github.com/pubky/pubky-core/issues
- Documentation: Knowledge Base
Reporting Bugs
Section titled “Reporting Bugs”When reporting bugs, include:
- Environment: OS, browser/platform version, SDK version
- Steps to reproduce: Exact sequence that causes the issue
- Error messages: Full error text and stack traces
- Expected vs actual: What should happen vs what happens
- Logs: Relevant logs from Homeserver/client
Example:
## Environment- OS: macOS 14.2- SDK: @synonymdev/pubky@0.9.1- Browser: Chrome 120
## Steps to Reproduce1. Call `await session.storage.putText('/pub/test/file.json', data)`2. Observe error
## Error MessageError: Failed to PUT /pub/test/file.json: 500 Internal Server Error
## ExpectedData should be stored successfully
## Actual500 error returnedUseful Debugging Tools
Section titled “Useful Debugging Tools”Set Log Level:
// Call once at application startup, before creating Pubky or Client instances.setLogLevel("debug");Browser DevTools:
Open DevTools → Network tab → Filter: pubkyCommand Line:
# Test PKARRcurl "https://pkarr.pubky.org/<public-key>"
# Test homeservercurl -v "https://homeserver.com/pub/..."
# Check DNSdig @8.8.8.8 <public-key>
# Test PKDNSdig @pkdns.pkarr.org <public-key>Pubky CLI:
# Check user infopubky-cli user session ./recovery.file
# Test data operationspubky-cli user get /pub/test ./recovery.file
# Admin diagnosticsPUBKY_ADMIN_PASSWORD=admin pubky-cli admin infoSee Also
Section titled “See Also”- Getting Started: Setup guides
- FAQ: Frequently asked questions
- SDK Documentation: Detailed API docs
- PKDNS: DNS resolution details
- Homeserver: Homeserver administration