chenfei-wu/TaskMatrix · error

internal errors

Error message

internal errors

What it means

Generic 500 response body returned by /api/get_workflow when any exception occurs during processing. It deliberately hides details; the real cause is only in the server log (the sibling 'failed to get_workflow' message).

Source

Thrown at LowCodeLLM/src/app.py:35

    '%(asctime)s - %(levelname)s - %(filename)s - %(funcName)s - %(lineno)s - %(message)s')
default_handler.setFormatter(logging_format)

@app.route("/")
def index():
    return send_from_directory(".", "index.html")

@app.route('/api/get_workflow', methods=['POST'])
@cross_origin()
def get_workflow():
    try:
        request_content = request.get_json()
        task_prompt = request_content['task_prompt']
        workflow = llm.get_workflow(task_prompt)
        return workflow, 200
    except Exception as e:
        app.logger.error(
            'failed to get_workflow, msg:%s, request data:%s' % (str(e), request.json))
        return {'errmsg': 'internal errors'}, 500

@app.route('/api/extend_workflow', methods=['POST'])
@cross_origin()
def extend_workflow():
    try:
        request_content = request.get_json()
        task_prompt = request_content['task_prompt']
        current_workflow = request_content['current_workflow']
        step = request_content['step']
        sub_workflow = llm.extend_workflow(task_prompt, current_workflow, step)
        return sub_workflow, 200
    except Exception as e:
        app.logger.error(
            'failed to extend_workflow, msg:%s, request data:%s' % (str(e), request.json))
        return {'errmsg': 'internal errors'}, 500

@app.route('/api/execute', methods=['POST'])
@cross_origin()

View on GitHub (pinned to 4b7664f8d3)

Solutions

  1. Reproduce while tailing the Flask logs and read the 'failed to get_workflow, msg:...' line for the underlying exception.
  2. Fix the named cause: KeyError -> send task_prompt as JSON; openai errors -> fix key/env config.
  3. Consider returning 400 for client-input errors instead of blanket 500s so callers can distinguish.

Example fix

// before
return {'errmsg': 'internal errors'}, 500
// after (app.py)
except KeyError as e:
    return {'errmsg': f'missing field: {str(e)}'}, 400
except Exception as e:
    app.logger.error('failed to get_workflow, msg:%s' % str(e))
    return {'errmsg': 'internal errors'}, 500
Defensive patterns

Strategy: try-catch

Try / catch

resp = requests.post(url, json=payload)
if resp.status_code == 500 and resp.json().get('errmsg') == 'internal errors':
    # opaque: inspect server log; do not blindly retry input errors

Prevention

When it happens

Trigger: Same handler as index 0: malformed/missing JSON, missing task_prompt key, or OpenAI call failure inside llm.get_workflow all produce this {'errmsg': 'internal errors'} 500 response.

Common situations: Client sees only this opaque message because the server hides the exception; developer must read the server-side log to distinguish bad input (4xx-class mistake) from OpenAI/config problems.

Related errors


AI-assisted analysis of chenfei-wu/TaskMatrix@4b7664f8d3 (2026-08-27). Data as JSON: /api/errors/d34578ec6d3f8fa8. Report an issue: GitHub.