tinyhumansai/openhuman · error

Missing required parameter 'role'

Error message

Missing required parameter 'role'

What it means

After session_id validates, insert_sql_record extracts 'role'; this fires when args lack a 'role' string (expected values like user/assistant). Nothing is written to the SQL store on this path.

Source

Thrown at src/openhuman/tools/impl/system/insert_sql_record.rs:83

            }
        })
    }

    fn permission_level(&self) -> PermissionLevel {
        PermissionLevel::Write
    }

    async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
        // ── Parameter extraction ────────────────────────────────────────────
        let session_id = args
            .get("session_id")
            .and_then(|v| v.as_str())
            .ok_or_else(|| anyhow::anyhow!("Missing required parameter 'session_id'"))?;

        let role = args
            .get("role")
            .and_then(|v| v.as_str())
            .ok_or_else(|| anyhow::anyhow!("Missing required parameter 'role'"))?;

        let content = args
            .get("content")
            .and_then(|v| v.as_str())
            .ok_or_else(|| anyhow::anyhow!("Missing required parameter 'content'"))?;

        let lesson = args.get("lesson").and_then(|v| v.as_str());

        // ── Validation ──────────────────────────────────────────────────────
        if !VALID_ROLES.contains(&role) {
            return Ok(ToolResult::error(format!(
                "Invalid role '{role}'. Must be one of: user, assistant, tool."
            )));
        }

        if session_id.trim().is_empty() {
            return Ok(ToolResult::error("'session_id' must not be empty."));
        }

View on GitHub (pinned to 7491200858)

Solutions

  1. Include a "role" string (e.g. "user" or "assistant") in the record
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/tools/impl/system/insert_sql_record.rs:83 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/aa3d5da7fda498a6. Report an issue: GitHub.