Skip to content

fix: The detected filetype is PLAIN_TEXT, but the provided filetype was HTML#6885

Open
github-actions[bot] wants to merge 1 commit intomainfrom
goose/issue-6873
Open

fix: The detected filetype is PLAIN_TEXT, but the provided filetype was HTML#6885
github-actions[bot] wants to merge 1 commit intomainfrom
goose/issue-6873

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Feb 1, 2026

Closes #6873

Summary

Issue #6873 Fix Summary

Problem

When using Goose with the AWS Bedrock provider, viewing .html files containing template syntax (Jinja2, Django, etc.) caused a ValidationException error:
"The detected filetype is PLAIN_TEXT, but the provided filetype was HTML."

This occurred because the to_bedrock_document() function determined the document format based on file extension. When it encountered .html files, it declared them as Html format to Bedrock's API. However, Bedrock validates content against the declared format, and template files containing {{ }} or {% %} syntax aren't valid HTML according to Bedrock's content validator.

Solution

Removed HTML from the list of supported document formats in the to_bedrock_document() function. HTML files now fall through to the default case (_ => return Ok(None)), which means they are handled as plain text content instead of being declared as HTML documents.

Change Made

File: crates/goose/src/providers/formats/bedrock.rs

Removed line:

Some((name, "html")) => (name, bedrock::DocumentFormat::Html),

From the match statement at line 258-263:

// Before:
let (name, format) = match filename.split_once('.') {
    Some((name, "txt")) => (name, bedrock::DocumentFormat::Txt),
    Some((name, "csv")) => (name, bedrock::DocumentFormat::Csv),
    Some((name, "md")) => (name, bedrock::DocumentFormat::Md),
    Some((name, "html")) => (name, bedrock::DocumentFormat::Html),  // REMOVED
    _ => return Ok(None), // Not a supported document type
};

// After:
let (name, format) = match filename.split_once('.') {
    Some((name, "txt")) => (name, bedrock::DocumentFormat::Txt),
    Some((name, "csv")) => (name, bedrock::DocumentFormat::Csv),
    Some((name, "md")) => (name, bedrock::DocumentFormat::Md),
    _ => return Ok(None), // Not a supported document type
};

Verification

  • cargo check - passed
  • cargo fmt - passed
  • ./scripts/clippy-lint.sh - passed (pre-existing warnings only)

Impact

  • HTML files will now be handled as plain text content, avoiding Bedrock's content validation
  • No impact on other file types (txt, csv, md)
  • This is the minimal safe fix as suggested in the issue comments

Generated by goose Issue Solver

@blackgirlbytes blackgirlbytes marked this pull request as ready for review February 2, 2026 02:29
Copilot AI review requested due to automatic review settings February 2, 2026 02:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The detected filetype is PLAIN_TEXT, but the provided filetype was HTML

1 participant