While importing md files I get "bad indentation of a mapping entry (3:12)"

Operating system

macOS

Joplin version

3.4.12

Desktop version info

Joplin for Desktop

Copyright © 2016-2025 Laurent Cozic
Joplin 3.4.12 (prod, darwin)

Gerät: darwin, Apple M2 Pro
Client-ID: 8a9ef92733844c77b7110b963257bbd8
Sync-Version: 3
Profil-Version: 48
Unterstützter Schlüsselbund: Ja
Alternative Instanz ID: -

Revision: e9a9f68

Backup: 1.4.3
Conflict Resolution: 1.2.3
Freehand Drawing: 3.1.0
macOS theme: 1.5.14
Math Mode: 0.7.1
Rich Markdown: 0.16.0
Table Formatter Plugin: 1.2.1

What issue do you have?

Hi,
First of all: Joplin is really great, thank you so much for it!
I’m experiencing an issue while importing md files. I get the following error message:
"bad indentation of a mapping entry (3:12)"

Functionally, what I’m trying to achieve is this: I’d like to import my emails to make them searchable offline, and sync it to my iPhone. I’m converting the emails with tika to html and with pandoc to md (with YAML frontmatter). So, with all that processing, it’s not at all surprising that maybe some of the md-files I’m trying to import are not perfectly clean. The issue is that when that problem happens, Joplin aborts the import-process altogether, and that’s of course not ideal.

If you have the time by any chance, I’d have three questions to help me move forward:

  1. Is it a totally absurd idea to import my emails in that way into Joplin? I’ve decided against importing the eml files for two main reasons: first, because converting them to md allows me to have much smaller files and to strip the attachments. Second, because converting them with tika allows me to do OCR on the attachments and integrate the result in the message, allowing me to search through the attachments without creating a bloated database in Joplin. If you have a better idea, I’d be very grateful! (And of course I’m happy to share my script. It’s not yet perfect but it did the job quite well and reasonably fast for tens of thousands of emails so far.)

  2. Is there a way to scan through the md-files and figure out what the exact problem is? And ideally batch solve it for all the files that are affected? Unfortunately it’s not all the files, and I haven’t figured out what is going on, yet.

  3. If 2 doesn’t work, is there a way to have Joplin skip the problematic files? Or a way to resume an import in some way? When importing folders, Joplin always recreates a separate folder and imports everything again, I have the impression. I’d like to import folders to keep the structure (I sorted the files by sender).

If you had the chance to help me, I’d be really grateful!

Have a great week-end, all the best!

Screenshots

Hi everyone,

Since I made some small progress, I wanted to report here how I found the error so that others might benefit from it too:

  1. I installed yamllint ( GitHub - adrienverge/yamllint: A linter for YAML files. ) Since I’m on Macos, using homebrew:
brew install yamllint
  1. Then I ran the command (found here Support YAML front-matter in markdown files · Issue #161 · adrienverge/yamllint · GitHub ) :
cat file.whatever \
  | python -c 'import sys; print(sys.stdin.read().split("\n---\n")[0])' \
  | yamllint -
  1. The output was pretty close to what Joplin had already told me, but It helped me identify the issue more easily:
4:12      error    syntax error: mapping values are not allowed here (syntax)

Basically, what happened was that some subject lines ended with “Re:”, which seemed like I wanted to map values there, although the line already starts with “subject:”. I’ll have to figure out a way to get rid of colons ( : ) in the subject lines to avoid that in the future.

If you have more general advice on the first point, the general idea, I’d be very grateful for your help.

All the best!