{"record":{"id":"ff0c7ad201a5a0ae","repo":"ytdl-org/youtube-dl","slug":"stderr-decode-utf-8-replace-strip-dynamic","errorCode":null,"errorMessage":"stderr.decode('utf-8', 'replace').strip() (dynamic AtomicParsley stderr)","messagePattern":"stderr\\.decode\\('utf-8', 'replace'\\)\\.strip\\(\\) \\(dynamic AtomicParsley stderr\\)","errorType":"exception","errorClass":"EmbedThumbnailPPError","httpStatus":null,"severity":"error","filePath":"youtube_dl/postprocessor/embedthumbnail.py","lineNumber":119,"sourceCode":"\n            cmd = [encodeFilename(atomicparsley, True),\n                   encodeFilename(filename, True),\n                   encodeArgument('--artwork'),\n                   encodeFilename(thumbnail_filename, True),\n                   encodeArgument('-o'),\n                   encodeFilename(temp_filename, True)]\n\n            self._downloader.to_screen('[atomicparsley] Adding thumbnail to \"%s\"' % filename)\n\n            if self._downloader.params.get('verbose', False):\n                self._downloader.to_screen('[debug] AtomicParsley command line: %s' % shell_quote(cmd))\n\n            p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n            stdout, stderr = process_communicate_or_kill(p)\n\n            if p.returncode != 0:\n                msg = stderr.decode('utf-8', 'replace').strip()\n                raise EmbedThumbnailPPError(msg)\n\n            if not self._already_have_thumbnail:\n                os.remove(encodeFilename(thumbnail_filename))\n            # for formats that don't support thumbnails (like 3gp) AtomicParsley\n            # won't create to the temporary file\n            if b'No changes' in stdout:\n                self._downloader.report_warning('The file format doesn\\'t support embedding a thumbnail')\n            else:\n                os.remove(encodeFilename(filename))\n                os.rename(encodeFilename(temp_filename), encodeFilename(filename))\n        else:\n            raise EmbedThumbnailPPError('Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.')\n\n        return [], info\n","sourceCodeStart":101,"sourceCodeEnd":134,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/postprocessor/embedthumbnail.py#L101-L134","documentation":"Raised by EmbedThumbnailPP when AtomicParsley ran but returned a non-zero exit code. The raised message is the tool's stderr (decoded, stripped), so the actual text comes from AtomicParsley itself — commonly unsupported file variants, corrupt input, or known AtomicParsley bugs (e.g. the 2020 'This file contains no cover art path' style failures).","triggerScenarios":"--embed-thumbnail on m4a/mp4 where AtomicParsley fails mid-run: damaged download, unusual container flags, or the widely-shipped buggy AtomicParsley 0.9.0 ('Error:.*?) builds from Homebrew/debian that crash on certain files.","commonSituations":"The old Homebrew/Debian AtomicParsley builds have a malloc bug that crashes on many m4a files; interrupted downloads producing truncated mp4s; DRM-adjacent or non-standard containers from some sites.","solutions":["Read the embedded stderr message — it names the exact AtomicParsley failure","Install a fixed AtomicParsley build (e.g. wez/atomicparsley or the mpeg4base patches) instead of the ancient 0.9.0 packages","Re-download the file (truncated input makes AtomicParsley fail) and retry","Or use yt-dlp, which uses ffmpeg to embed mp4/m4a thumbnails and avoids AtomicParsley entirely"],"exampleFix":"# before (buggy distro AtomicParsley)\napt install atomicparsley && youtube-dl --embed-thumbnail URL\n# after (modern fork)\npip install yt-dlp   # yt-dlp embeds mp4 thumbnails via ffmpeg\nyt-dlp --embed-thumbnail URL","handlingStrategy":"fallback","validationCode":"import subprocess, shutil\n\ndef atomicparsley_healthy():\n    exe = shutil.which('AtomicParsley') or shutil.which('atomicparsley')\n    if not exe:\n        return False\n    return subprocess.call([exe, '-v'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0","typeGuard":null,"tryCatchPattern":"try:\n    ydl.download([url])\nexcept PostProcessingError as e:\n    # e.msg is AtomicParsley's stderr — surface it, and keep the downloaded file\n    log.warning('Thumbnail embed failed (AtomicParsley): %s', e.msg)","preventionTips":["Use a maintained AtomicParsley fork; the 0.9.0 distro builds are crash-prone","Note that the media file is already downloaded when this fires — only the embed step failed","Keep AtomicParsley stderr in job logs; it identifies corrupt vs bug cases"],"tags":["embed-thumbnail","atomicparsley","external-tool","postprocessor"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}