Troubleshooting
Common issues and solutions when using md2wp.
Authentication Issues
"Authentication failed: 401 Unauthorized"
Symptoms:
❌ Connection failed
Authentication failed: 401 UnauthorizedCauses:
- Wrong Application Password
- Wrong username
- Application Password revoked
- Wrong WordPress URL
Solutions:
Check Application Password:
bashcat .env # Should show: MD2WP_PASSWORD="xxxx xxxx xxxx xxxx"Verify WordPress URL:
json// .md2wprc.json { "wordpress": { "siteUrl": "https://yoursite.com" // No trailing slash! } }Regenerate Application Password:
- WordPress Admin → Users → Profile
- Revoke old password
- Create new Application Password
- Update
.envfile
Check WordPress version:
bash# WordPress 5.6+ required # Or install Application Passwords plugin
"Config not found"
Symptoms:
❌ Error: Config not foundSolution:
# Initialize config files
md2wp initImage Issues
"Image not found"
Symptoms:
❌ ./images/photo.jpg
File not foundSolutions:
Check file exists:
bashls -la ./images/photo.jpgCheck path is relative:
markdown<!-- ✅ Good -->  <!-- ❌ Bad --> Check case sensitivity (Linux/macOS):
bash# photo.jpg vs Photo.jpg ls images/
"Image too large"
Symptoms:
⚠️ Large file size: 8.5 MB (recommend <2 MB)Solutions:
Optimize with ImageMagick:
bashmagick input.jpg -resize 2000x2000\> -quality 80 output.jpgUse online tools:
Check WordPress upload limit:
- WordPress Admin → Media → Add New
- See "Maximum upload file size"
"Failed to upload media"
Symptoms:
❌ Failed to upload: ./image.jpg
Failed to upload media: 500 Internal Server ErrorCauses:
- WordPress upload directory permissions
- PHP upload limit too low
- File type not allowed
Solutions:
Check WordPress upload settings:
- PHP
upload_max_filesize - PHP
post_max_size - PHP
memory_limit
- PHP
Check file permissions:
bash# WordPress uploads directory should be writable ls -la wp-content/uploads/Check allowed file types:
- WordPress Admin → Settings → Media
- Or contact hosting provider
Connection Issues
"Failed to connect to WordPress"
Symptoms:
❌ Failed to connect to WordPress: Network errorSolutions:
Check WordPress URL:
bashcurl https://yoursite.com/wp-json/ # Should return JSONCheck REST API enabled:
bashcurl https://yoursite.com/wp-json/wp/v2/Check firewall/security plugins:
- Some security plugins block REST API
- Wordfence, iThemes Security, etc.
- Add md2wp user-agent to allowlist
Check SSL certificate:
bashcurl https://yoursite.com/ # Should not show SSL errors
CLI Issues
"Command not found: md2wp"
Symptoms:
md2wp: command not foundSolutions:
Check installation:
bashnpm list -g @md2wp/cliCheck PATH:
bashecho $PATH npm config get prefixReinstall:
bashnpm install -g @md2wp/cliUse npx:
bashnpx @md2wp/cli publish post.md
"Permission denied (EACCES)"
Symptoms:
Error: EACCES: permission deniedSolutions:
Fix npm permissions (recommended):
bash# Use nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash nvm install 20 nvm use 20Or change npm directory:
bashmkdir ~/.npm-global npm config set prefix '~/.npm-global' echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc source ~/.bashrc
Build Issues
"Module not found"
For contributors:
Symptoms:
Error: Cannot find module '@md2wp/core'Solutions:
Install dependencies:
bashpnpm installBuild packages:
bashpnpm buildLink CLI:
bashpnpm link:cli
Frontmatter Issues
"Frontmatter must include a 'title' field"
Symptoms:
❌ Error: Frontmatter must include a "title" fieldSolution:
---
title: 'Your Post Title' # Required!
---"Invalid frontmatter status"
Symptoms:
❌ Error: Frontmatter status must be either "draft" or "publish"Solution:
---
status: draft # ✅ Correct
# status: published # ❌ Wrong
---Performance Issues
Slow uploads
Symptoms:
- Image uploads taking too long
- Connection timeouts
Solutions:
Optimize images before uploading:
bashmagick *.jpg -resize 2000x2000\> -quality 80 optimized/Check internet connection:
bashspeedtest-cliUse local WordPress for testing:
bash# LocalWP, MAMP, or Docker
Cache Issues
Cache not working
Symptoms:
- Images re-upload every time
- No cache hits
Solutions:
Check cache exists:
bashls -la .md2wp/cache.jsonCheck cache permissions:
bashchmod 644 .md2wp/cache.jsonRebuild cache:
bashrm -rf .md2wp/cache.json md2wp publish post.md
Debug Mode
Coming in v1.1.0:
md2wp publish post.md --verbose
md2wp publish post.md --debugCurrent workaround:
NODE_DEBUG=* md2wp publish post.mdGetting Help
Still having issues?
Check documentation:
Search GitHub Issues:
Create new issue:
- Report a bug
- Include:
- md2wp version (
md2wp --version) - Node.js version (
node --version) - WordPress version
- Error message
- Steps to reproduce
- md2wp version (
Community:
Common Workflows
Testing before production
# 1. Dry run first
md2wp publish post.md --dry-run
# 2. Publish as draft
md2wp publish post.md --draft
# 3. Review in WordPress
# 4. Update status in frontmatter
# status: publish
# 5. Publish for real
md2wp publish post.mdRecovering from failed publish
# 1. Check what went wrong
md2wp publish post.md --dry-run
# 2. Fix issues (images, frontmatter, etc.)
# 3. Clear cache if needed
rm -rf .md2wp/cache.json
# 4. Try again
md2wp publish post.mdBest Practices
To avoid issues:
- ✅ Use
--dry-runbefore first publish - ✅ Start with small posts
- ✅ Optimize images before uploading
- ✅ Keep md2wp updated
- ✅ Version control your markdown
- ✅ Test on staging first
- ✅ Back up WordPress regularly