Skip to content

Cron Create Fails with Model Parameter (TypeError) #6709

@Aleksei3020

Description

@Aleksei3020

Bug Description

When creating a cron job with a custom model parameter using an object format ({"model": "...", "provider": "..."}), the command fails with a TypeError.

ERROR MESSAGE:
TypeError: '<=' not supported between instances of 'str' and 'int'

This occurs when using the --model flag with a JSON object string during cron job creation. The cronjob update command handles the same model parameter correctly, which suggests inconsistent parameter handling between the create() and update() functions in the cronjob module.

The error happens during the validation logic in the create() function, where a string is being compared to an integer using <= operator.

Steps to Reproduce

  1. Open terminal and run the following command:

    cronjob create --prompt "test task" --schedule "0 9 * * *" --deliver telegram --model '{"model":"gemma4:31b","provider":"custom"}'

  2. Observe the error output:
    TypeError: '<=' not supported between instances of 'str' and 'int'

  3. The cron job is not created - command exits with error.

  4. Try the workaround - create without model, then update:
    cronjob create --prompt "test task" --schedule "0 9 * * *" --deliver telegram
    cronjob update --job_id --model '{"model":"gemma4:31b","provider":"custom"}'

    This works correctly, confirming the bug is in create() only.

Expected Behavior

The cronjob create command should accept the --model parameter with a JSON object string, exactly like the cronjob update command does.

Expected behavior:

  1. Command should parse the model parameter correctly
  2. Cron job should be created with the specified model configuration
  3. No TypeError should occur
  4. The created job should use the specified model (gemma4:31b from custom provider)

The create() and update() functions should have consistent parameter handling.

Actual Behavior

Command fails immediately with TypeError:

TypeError: '<=' not supported between instances of 'str' and 'int'

The cron job is NOT created. The command exits with an error code.

CURRENT WORKAROUND:

  1. Create the cron job WITHOUT the model parameter:
    cronjob create --prompt "test task" --schedule "0 9 * * *" --deliver telegram

  2. Update the job to add the model parameter:
    cronjob update --job_id --model '{"model":"gemma4:31b","provider":"custom"}'

This two-step process works correctly, which proves the model parsing logic exists and works in update() but is broken in create().

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Operating System

macOS 15.2 (Apple Silicon)

Python Version

3.11 (Homebrew)

Hermes Version

v0.8+ (development branch)

Relevant Logs / Traceback

Root Cause Analysis (optional)

The bug appears to be in the cronjob create() function's parameter validation logic.

SUSPECTED LOCATION:

  • File: Likely in cli.py or cronjob.py
  • Function: create()
  • Issue: Type comparison bug where a string value is compared to an integer using <= operator

The update() function handles the same model object correctly, which suggests:

  1. The model parameter parsing code exists and works
  2. The create() function has different (broken) validation logic
  3. Both functions should use the same parsing/validation code path

RECOMMENDED FIX:
Unify the model parameter parsing and validation between create() and update() functions. Review the type checking logic for model configuration objects in the create() function.

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    sweeper:cannot-reproduceSweeper: could not reproduce on current maintype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions