====== Calendar Plugin - Debug Instructions ======
===== Debugging Recurring Event Issues =====
If recurring events are not appearing when navigating between months, the JSON event files may be corrupted or malformed. Follow these steps to diagnose the issue.
==== Method 1: Using the Debug Script (Recommended) ====
- SSH into your server
- Navigate to the calendar plugin directory:
cd /path/to/dokuwiki/lib/plugins/calendar/
- Run the debug script for the month you want to inspect:
# Check March 2027
php debug_events.php "" 2027-03
# Check January 2026
php debug_events.php "" 2026-01
# Check with namespace
php debug_events.php "team" 2027-03
The script will show you:
* ✓ If the file exists
* ✓ Raw file contents
* ✓ JSON validation errors
* ✓ All events in the file
* ⚠️ Any problems (invalid UTF-8, unexpected fields, corrupted data)
==== Method 2: Manual File Inspection ====
Navigate to your DokuWiki data directory:
cd /path/to/dokuwiki/data/meta/calendar/
ls -la
You should see JSON files like:
* ''2026-01.json'' (January 2026)
* ''2026-03.json'' (March 2026)
* ''2027-03.json'' (March 2027)
* etc.
View the contents of a specific month:
cat 2027-03.json
Or use a text editor:
nano 2027-03.json
# or
vi 2027-03.json
==== What Good JSON Looks Like ====
A properly formatted event file should look like this:
{
"2027-03-15": [
{
"id": "abc123-1",
"title": "Yearly Event",
"time": "",
"description": "",
"color": "#3498db",
"isTask": false,
"completed": false,
"endDate": "",
"recurring": true,
"recurringId": "abc123",
"created": "2026-01-24 10:30:00"
}
],
"2027-03-20": [
{
"id": "xyz789",
"title": "Another Event",
"time": "14:00",
"description": "Meeting notes",
"color": "#008800",
"isTask": false,
"completed": false,
"endDate": "",
"recurring": false,
"created": "2027-03-15 09:00:00"
}
]
}
==== Common Problems to Look For ====
=== 1. Truncated/Corrupted File ===
{
"2027-03-15": [
{
"id": "abc123-1",
"title": "Yearly
**Problem:** File is incomplete, missing closing braces.
**Fix:** Delete the corrupted file and recreate the event.
=== 2. Invalid Characters ===
{"2027-03-15":[{"title":"Test\x00Event"}]}
**Problem:** Null bytes or invalid UTF-8 characters.
**Fix:** Edit the file and remove invalid characters, or delete and recreate.
=== 3. Empty or Malformed ===
{}[]
**Problem:** Invalid JSON structure.
**Fix:** Delete the file or replace with ''{}''
=== 4. Multiple Root Objects ===
{"2027-03-15":[...]}
{"2027-03-16":[...]}
**Problem:** Two separate JSON objects instead of one merged object.
**Fix:** Manually merge into a single object or delete and recreate events.
==== Browser Console Debugging ====
- Open your browser's Developer Tools (''F12'')
- Go to the **Console** tab
- Navigate between months in the calendar
- Look for messages like:
Month navigation data: {success: true, events: {...}, year: 2027, month: 3}
Rebuilding calendar for 2027 3 with 1 date entries
**Key things to check:**
* ''success: true'' - API call worked
* ''events: {...}'' - Should contain event data
* ''"with X date entries"'' - Should be > 0 if events exist
**If you see "with 0 date entries":**
* The JSON file is empty, missing, or corrupted
* Check the actual file with the debug script
==== Fixing Corrupted Files ====
=== Option 1: Delete and Recreate ===
# Back up first!
cp /path/to/dokuwiki/data/meta/calendar/2027-03.json /tmp/backup-2027-03.json
# Delete corrupted file
rm /path/to/dokuwiki/data/meta/calendar/2027-03.json
# Recreate the recurring event in the calendar UI
=== Option 2: Manual Fix ===
# Edit the file
nano /path/to/dokuwiki/data/meta/calendar/2027-03.json
# Ensure it's valid JSON - use a validator like:
# https://jsonlint.com/
# Save and test
=== Option 3: Reset Empty File ===
If the file exists but is corrupted, reset it to empty:
echo '{}' > /path/to/dokuwiki/data/meta/calendar/2027-03.json
Then recreate events through the UI.
==== Checking DokuWiki Error Logs ====
The updated plugin now logs JSON errors to DokuWiki's error log:
# Check for JSON decode errors
tail -f /path/to/dokuwiki/data/cache/error.log | grep Calendar
# Or view recent errors
tail -100 /path/to/dokuwiki/data/cache/error.log | grep Calendar
Look for messages like:
* ''Calendar: JSON decode error in /path/to/2027-03.json: Syntax error''
* ''Calendar: JSON decode error in /path/to/2027-03.json: Unexpected end of file''
==== Full Diagnostic Checklist ====
Run through this checklist:
| Step | Command | Expected Result |
|---|---|---|
| 1. Check file exists | ls -la /path/to/dokuwiki/data/meta/calendar/2027-03.json |
File should exist with size > 0 |
| 2. View file contents | cat /path/to/dokuwiki/data/meta/calendar/2027-03.json |
Valid JSON structure |
| 3. Validate JSON | php debug_events.php "" 2027-03 |
"✓ Valid JSON" |
| 4. Check event count | Output from debug script | Shows recurring events |
| 5. Check error logs | tail /path/to/dokuwiki/data/cache/error.log |
No Calendar errors |
| 6. Browser console | F12 → Console tab | "Rebuilding calendar... with X date entries" |
# From DokuWiki root
php -r "include 'inc/init.php'; echo DOKU_INC . 'data/meta/calendar/';"
==== Still Having Issues? ====
If you've checked everything and events still don't appear:
- Share the output of: ''php debug_events.php "" 2027-03''
- Share the browser console output when navigating to the month
- Share the contents of the JSON file: ''cat 2027-03.json''
- Check file permissions: ''ls -la /path/to/dokuwiki/data/meta/calendar/''
The web server needs read/write access to the calendar directory:
# Fix permissions (adjust www-data to your web server user)
chown -R www-data:www-data /path/to/dokuwiki/data/meta/calendar/
chmod -R 755 /path/to/dokuwiki/data/meta/calendar/
===== Quick Reference =====
# View March 2027 events
php /path/to/dokuwiki/lib/plugins/calendar/debug_events.php "" 2027-03
# View all calendar files
ls -la /path/to/dokuwiki/data/meta/calendar/
# Check for errors
tail -f /path/to/dokuwiki/data/cache/error.log | grep Calendar
# Validate JSON online
cat 2027-03.json | curl -X POST -H "Content-Type: application/json" -d @- https://jsonlint.com/
----
**Version:** 3.2\\
**Last Updated:** January 24, 2026