Bug Report: Inkdrop Fails to Start Due to Missing Note Reference
Summary
Inkdrop application becomes completely unusable when it tries to open a note that has been deleted from the database but is still referenced in the configuration file.
Environment
- Application: Inkdrop
- Platform: macOS
- Config Location:
~/Library/Application Support/inkdrop/config.json
- Error Type: 404 Not Found - Missing Note
Problem Description
When launching Inkdrop, the application fails to start properly and displays an error:
{
"stack": "not_found: missing\n at 62198 (/Applications/Inkdrop.app/Contents/Resources/app.asar/main-195.js:2:402957)\n at s (/Applications/Inkdrop.app/Contents/Resources/app.asar/main.js:2:789146)\n at 34214 (/Applications/Inkdrop.app/Contents/Resources/app.asar/main-214.js:1:221)\n at Function.s (/Applications/Inkdrop.app/Contents/Resources/app.asar/main.js:2:789146)",
"status": 404,
"name": "not_found",
"message": "missing",
"error": true,
"reason": "missing",
"docId": "note:noYYkgRx"
}
This error prevents the user from accessing any functionality in the application.
Root Cause
The issue occurs when:
- A note (in this case
note:noYYkgRx
) is deleted from the database - The note ID remains stored in
config.json
underlastNavigationState.editingNoteId
- On startup, Inkdrop attempts to load this non-existent note
- The 404 error blocks the entire application from functioning
Investigation Process
1. Verified Note Doesn’t Exist
curl -u username:password "http://localhost:19840/notes/note:noYYkgRx"
# Result: Not Found
2. Checked for References
Searched for the note ID in:
- Bookmarks: Not found
- Other notes linking to it: No references found
- Recent notes list: Not present
3. Located Configuration Issue
grep -r "note:noYYkgRx" ~/Library/Application\ Support/inkdrop/
# Found in: ~/Library/Application Support/inkdrop/config.json
4. Identified Exact Location
grep -A2 -B2 "editingNoteId" ~/Library/Application\ Support/inkdrop/config.json
# Output:
# },
# "lastNavigationState": {
# "editingNoteId": "note:noYYkgRx",
# "queryContext": {
# "mode": "all",
Solution
Quick Fix (Applied Successfully)
-
Backup the configuration:
cp ~/Library/Application\ Support/inkdrop/config.json ~/Library/Application\ Support/inkdrop/config.json.backup
-
Set the editingNoteId to null:
sed -i '' 's/"editingNoteId": "note:noYYkgRx"/"editingNoteId": null/g' ~/Library/Application\ Support/inkdrop/config.json
-
Verify the change:
grep -A2 -B2 "editingNoteId" ~/Library/Application\ Support/inkdrop/config.json
-
Restart Inkdrop - the application now starts normally
Recommendations for Inkdrop Development Team
1. Graceful Error Handling
- Implement a try-catch mechanism when loading the last edited note on startup
- If a note is not found, fall back to a default view (e.g., All Notes) instead of blocking the entire application
2. Validation on Startup
// Pseudo-code example
async function loadLastEditingNote() {
const config = loadConfig();
const noteId = config.lastNavigationState?.editingNoteId;
if (noteId) {
try {
await loadNote(noteId);
} catch (error) {
if (error.status === 404) {
// Clear the invalid reference
config.lastNavigationState.editingNoteId = null;
saveConfig(config);
// Load default view
loadDefaultView();
} else {
throw error;
}
}
}
}
3. Database Integrity Check
- When deleting notes, ensure all references are cleaned up, including:
- Navigation state
- Bookmarks
- Cross-references in other notes
4. Recovery Mode
- Add a command-line flag or keyboard shortcut to start Inkdrop in “safe mode” without loading the last state
- Example:
inkdrop --safe-mode
or holding Shift while starting
5. User-Friendly Error Display
- Instead of showing a technical JSON error, display a user-friendly message:
- “The note you were previously editing has been deleted. Loading your notes list instead.”
Steps to Reproduce
- Create a note in Inkdrop
- Close Inkdrop while that note is open
- Manually delete the note from the database (or corrupt the database)
- Try to reopen Inkdrop
- Application fails to start with 404 error
Impact
- Severity: High - Application becomes completely unusable
- User Experience: Very poor - User cannot access any of their notes
- Data Loss: No - Notes are safe, only access is blocked
Workaround for Users
If encountering this issue:
- Close Inkdrop completely
- Navigate to
~/Library/Application Support/inkdrop/
(macOS) - Edit
config.json
- Find
"editingNoteId": "note:XXXXX"
- Change it to
"editingNoteId": null
- Save and restart Inkdrop
Report Date: June 29, 2025
Affected Version: Current release (as of June 2025)
Status: Workaround available, permanent fix needed