Skip to content

error 400 at small changes #14

@Sethakan

Description

@Sethakan

Hello. Im trying to build ai automation for my homebattery an ev. I do this with my homey pro 2023 and chat gpt. I have som problems. The the following text is ai generated. I know nothing about coding.

Here is a clear, concise GitHub-ready issue description you can copy/paste:


Title:

OpenAI “Ask ChatGPT… and WAIT” card clears prompt & sends empty messages → 400 error


Description:

I’m experiencing a consistent issue with the “Ask ChatGPT the question … and WAIT for the full answer” card in Homey.

Whenever I edit the prompt text in the card (even small changes), the card often breaks and the OpenAI API returns:

Error 400: Invalid 'messages': empty array. Expected array with minimum length 1, but got an empty array instead.

This means the card is sending:

{
  "messages": []
}

instead of the original long prompt.

What seems to happen:

  • The card uses one single text field for the entire prompt.
  • When the text becomes long (multi-section system rules, JSON-templates, etc.), saving or editing the field frequently causes Homey to silently clear the internal messages list before the request is sent.
  • As soon as Homey sends messages: [], OpenAI returns 400 and the flow becomes unusable.

Reproduction:

  1. Create a flow with the “Ask ChatGPT the question… and WAIT” card.
  2. Paste a long prompt (multiple sections, rules, JSON instructions).
  3. Save → works initially.
  4. Reopen the card and add even a single new line or small change.
  5. Save again → next execution throws:
    Error 400 Invalid 'messages': empty array.

Expected behavior:

  • The card should preserve the internal message array even when editing long prompt text.
  • Saving the card should not produce an invalid empty messages array.

Actual behavior:

  • After editing the text field, the card sometimes resets the internal messages array to empty, causing all API calls to fail.

Impact:

  • It becomes impossible to maintain or update complex prompts (e.g., Home-energy optimization logic, multi-rule system prompts, structured JSON outputs).
  • The card becomes unusable for advanced automation.
  • The only workaround is to completely re-paste the entire prompt every time and hope the save doesn’t clear the messages array.

Request:

Please investigate why editing the text field causes the card to send an empty messages array. Ideally, the card should always:

  • treat the text field as the system message, or
  • expose explicit “system” and “user” message fields (similar to OpenAI Pro),
  • and never send messages: [] under any circumstances.

If you want, I can also help you write a short repro flow or attach simplified test prompts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions