Skip to content

[update]: pdd update fails to generate prompt file if prompt file does not exist. #191

@Isrothy

Description

@Isrothy

Reproduction

mkdir pdd-issue
cd pdd-issue
echo "print('hello world')" >> hello.py
pdd --core-dump update --output hello_python.prompt hello.py 

Expected Behavior

Generate a prompt file hello_python.prompt

Error Message

Invalid path provided for modified_code_file: 'None' - argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'
Error: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'
Error during 'update' command:
  An unexpected error occurred: cannot unpack non-iterable NoneType object
Debug: collect_files called
Debug: args = (<click.core.Context object at 0x10fbffed0>,)
Debug: kwargs keys = ['output', 'input_prompt_file', 'modified_code_file', 'input_code_file', 'use_git', 'extensions']
Debug: kwargs = {'output': 'hello_python.prompt', 'input_prompt_file': 'hello.py', 'modified_code_file': None, 'input_code_file': None, 'use_git': False, 'extensions': None}
Debug: Collected input files: ['hello.py']
Debug: Collected output files: ['hello_python.prompt']
Debug: Added to core_dump_files: /Users/jiangjoshua/tmp/pdd-issue/hello.py (exists: True)
Debug: Added to core_dump_files: /Users/jiangjoshua/tmp/pdd-issue/hello_python.prompt (exists: False)
Debug: Total files in core_dump_files: 2

--- Command Execution Summary ---
Error during 'unknown' command:
  An unexpected error occurred: 'NoneType' object is not iterable
Core dump: Found 2 tracked files
Core dump: Checking file /Users/jiangjoshua/tmp/pdd-issue/hello.py
Core dump: Added content for hello.py
Core dump: Checking file /Users/jiangjoshua/tmp/pdd-issue/hello_python.prompt
Core dump: File not found or not a file: /Users/jiangjoshua/tmp/pdd-issue/hello_python.prompt
Core dump written to /Users/jiangjoshua/tmp/pdd-issue/.pdd/core_dumps/pdd-core-20251213T200118Z.json. You can attach this file when reporting a bug.

Core dumped:

{
  "schema_version": 1,
  "pdd_version": "0.0.82",
  "timestamp_utc": "20251213T200118Z",
  "argv": [
    "--core-dump",
    "update",
    "--output",
    "hello_python.prompt",
    "hello.py"
  ],
  "cwd": "/Users/jiangjoshua/tmp/pdd-issue",
  "platform": {
    "system": "Darwin",
    "release": "25.1.0",
    "version": "Darwin Kernel Version 25.1.0: Mon Oct 20 19:34:05 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_T6041",
    "python": "3.13.11 (main, Dec  5 2025, 16:06:33) [Clang 17.0.0 (clang-1700.4.4.1)]"
  },
  "global_options": {
    "force": false,
    "strength": 0.75,
    "temperature": 0.0,
    "time": 0.25,
    "verbose": false,
    "quiet": false,
    "local": false,
    "context": null,
    "output_cost": null,
    "review_examples": false
  },
  "invoked_subcommands": [
    "update"
  ],
  "total_cost": 0.0,
  "steps": [],
  "errors": [
    {
      "command": "update",
      "type": "TypeError",
      "message": "cannot unpack non-iterable NoneType object",
      "traceback": "Traceback (most recent call last):\n  File \"/Users/jiangjoshua/Library/Application Support/pipx/venvs/pdd-cli/lib/python3.13/site-packages/pdd/commands/modify.py\", line 177, in update\n    result, total_cost, model_name = update_main(\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nTypeError: cannot unpack non-iterable NoneType object\n"
    },
    {
      "command": "unknown",
      "type": "TypeError",
      "message": "'NoneType' object is not iterable",
      "traceback": "Traceback (most recent call last):\n  File \"/Users/jiangjoshua/Library/Application Support/pipx/venvs/pdd-cli/lib/python3.13/site-packages/pdd/core/cli.py\", line 89, in invoke\n    result = super().invoke(ctx)\n  File \"/Users/jiangjoshua/Library/Application Support/pipx/venvs/pdd-cli/lib/python3.13/site-packages/click/core.py\", line 1688, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/Users/jiangjoshua/Library/Application Support/pipx/venvs/pdd-cli/lib/python3.13/site-packages/click/core.py\", line 1657, in _process_result\n    value = ctx.invoke(self._result_callback, value, **ctx.params)\n  File \"/Users/jiangjoshua/Library/Application Support/pipx/venvs/pdd-cli/lib/python3.13/site-packages/click/core.py\", line 783, in invoke\n    return __callback(*args, **kwargs)\n  File \"/Users/jiangjoshua/Library/Application Support/pipx/venvs/pdd-cli/lib/python3.13/site-packages/click/decorators.py\", line 33, in new_func\n    return f(get_current_context(), *args, **kwargs)\n  File \"/Users/jiangjoshua/Library/Application Support/pipx/venvs/pdd-cli/lib/python3.13/site-packages/pdd/core/cli.py\", line 453, in process_commands\n    if num_results < num_commands and not all(res is None for res in results): # Avoid printing if all failed\n                                                                     ^^^^^^^\nTypeError: 'NoneType' object is not iterable\n"
    }
  ],
  "environment": {
    "PATH": "/opt/homebrew/Cellar/pyenv/2.6.16/libexec:/opt/homebrew/Cellar/pyenv/2.6.16/plugins/python-build/bin:/Users/jiangjoshua/.pyenv/shims:/Applications/Docker.app/Contents/Resources/cli-plugins/:/Applications/Docker.app/Contents/Resources/bin:/Users/jiangjoshua/.local/bin:/Users/jiangjoshua/.rustup/toolchains/nightly-aarch64-apple-darwin/bin:/opt/homebrew/opt/zip/bin:/opt/homebrew/opt/tcl-tk@8/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/opt/postgresql@16/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/curl/bin:/opt/homebrew/bin:/opt/homebrew/opt/openjdk@21/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/pmk/env/global/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Users/jiangjoshua/.cargo/bin:/Applications/kitty.app/Contents/MacOS:/Users/jiangjoshua/Library/Application Support/Coursier/bin:/Users/jiangjoshua/Library/Application Support/JetBrains/Toolbox/scripts:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/lib:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/aliases:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/cabal:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/colored-man-pages:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/colorize:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/command-not-found:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/copybuffer:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/copyfile:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/copypath:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/dirhistory:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/fzf:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/git:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/gitignore:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/history-substring-search:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/jsontools:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/macos:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/stack:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/sudo:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/web-search:/Users/jiangjoshua/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/zoxide:/Users/jiangjoshua/.antigen/bundles/hlissner/zsh-autopair:/Users/jiangjoshua/.antigen/bundles/Aloxaf/fzf-tab:/Users/jiangjoshua/.antigen/bundles/zsh-users/zsh-completions:/Users/jiangjoshua/.antigen/bundles/zsh-users/zsh-syntax-highlighting:/Users/jiangjoshua/.antigen/bundles/zsh-users/zsh-autosuggestions:/Users/jiangjoshua/.antigen/bundles/jeffreytse/zsh-vi-mode:/Users/jiangjoshua/.lmstudio/bin:/Users/jiangjoshua/.cabal/bin:/Users/jiangjoshua/.ghcup/bin",
    "PDD_PATH": "/Users/jiangjoshua/Library/Application Support/pipx/venvs/pdd-cli/lib/python3.13/site-packages/pdd"
  },
  "file_contents": {
    "hello.py": "print('hello world')\n"
  },
  "terminal_output": "=== STDOUT ===\nChecking for updates...\nInvalid path provided for modified_code_file: 'None' - argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'\nError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'\nError during 'update' command:\n  An unexpected error occurred: cannot unpack non-iterable NoneType object\nDebug: collect_files called\nDebug: args = (<click.core.Context object at 0x10fbffed0>,)\nDebug: kwargs keys = ['output', 'input_prompt_file', 'modified_code_file', 'input_code_file', 'use_git', 'extensions']\nDebug: kwargs = {'output': 'hello_python.prompt', 'input_prompt_file': 'hello.py', 'modified_code_file': None, 'input_code_file': None, 'use_git': False, 'extensions': None}\nDebug: Collected input files: ['hello.py']\nDebug: Collected output files: ['hello_python.prompt']\nDebug: Added to core_dump_files: /Users/jiangjoshua/tmp/pdd-issue/hello.py (exists: True)\nDebug: Added to core_dump_files: /Users/jiangjoshua/tmp/pdd-issue/hello_python.prompt (exists: False)\nDebug: Total files in core_dump_files: 2\n\n--- Command Execution Summary ---\nError during 'unknown' command:\n  An unexpected error occurred: 'NoneType' object is not iterable\n"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions