{"record":{"id":"2d8a9e111d0aa198","repo":"mattermost-community/focalboard","slug":"invalid-image-block","errorCode":null,"errorMessage":"invalid image block","messagePattern":"invalid image block","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/model/import_export.go","lineNumber":10,"sourceCode":"package model\n\nimport (\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n)\n\nvar (\n\tErrInvalidImageBlock = errors.New(\"invalid image block\")\n)\n\n// Archive is an import / export archive.\n// TODO: remove once default templates are converted to new archive format.\ntype Archive struct {\n\tVersion int64   `json:\"version\"`\n\tDate    int64   `json:\"date\"`\n\tBlocks  []Block `json:\"blocks\"`\n}\n\n// ArchiveHeader is the content of the first file (`version.json`) within an archive.\ntype ArchiveHeader struct {\n\tVersion int   `json:\"version\"`\n\tDate    int64 `json:\"date\"`\n}\n\n// ArchiveLine is any line in an archive.\ntype ArchiveLine struct {","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/mattermost-community/focalboard/blob/a84bbb65e32edf972856b329417096ac413518e9/server/model/import_export.go#L1-L28","documentation":"ErrInvalidImageBlock is returned by extractFilename during archive import/export when an image block lacks the data needed to determine its filename. Image blocks are expected to reference an uploaded file with a valid path/name; a malformed or non-image block passed to the extractor yields this sentinel error.","triggerScenarios":"Importing an archive whose image block is missing a fileId/attachment reference or has malformed content; extractFilename called on a block that is not actually an image block.","commonSituations":"Hand-edited or third-party-generated archive JSON files; archives exported from older Boards versions with a different block schema; corrupted uploads during migration.","solutions":["Validate the archive's image blocks include a valid file reference before import","Re-export the archive from a working Boards instance","Fix or drop the malformed image block from the archive JSON"],"exampleFix":"// before\nblock := blocks[i] // assumed image\nname, err := extractFilename(block)\n// after\nif block.Type != model.TypeImage || block.FileId == \"\" {\n    return fmt.Errorf(\"skipping invalid image block %s\", block.ID)\n}\nname, err := extractFilename(block)","handlingStrategy":"validation","validationCode":"if block.Type != model.TypeImage || block.FileId == \"\" {\n    // skip or repair before calling extractFilename\n}","typeGuard":"func isInvalidImageBlockErr(err error) bool {\n    return errors.Is(err, model.ErrInvalidImageBlock)\n}","tryCatchPattern":"name, err := extractFilename(block)\nif errors.Is(err, model.ErrInvalidImageBlock) {\n    log.Printf(\"skipping bad image block %s\", block.ID)\n    return \"\", nil // continue import\n}","preventionTips":["Validate archive JSON against the schema before import","Only call extractFilename on image-typed blocks","Skip-and-log bad blocks rather than failing the whole import"],"tags":["go","import-export","image-block","validation"],"backgroundTag":"invalid-archive-block","analyzedSha":"a84bbb65e32edf972856b329417096ac413518e9","analyzedAt":"2026-08-30T09:22:20.720Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}