wavetermdev/waveterm · error
file %s:%s is not an ijson file
Error message
file %s:%s is not an ijson file
What it means
CompactIJson requires the target file to have been created with the IJson option. IJson files are compacted via a special command-log compaction path (compactIJson); calling it on a regular binary/append file would corrupt or misread its parts, so it is rejected.
Source
Thrown at pkg/filestore/blockstore.go:317
if err != nil {
return err
}
newBytes, err := ijson.CompactIJson(fullData, entry.File.Opts.IJsonBudget)
if err != nil {
return err
}
entry.writeAt(0, newBytes, true)
return nil
}
func (s *FileStore) CompactIJson(ctx context.Context, zoneId string, name string) error {
return withLock(s, zoneId, name, func(entry *CacheEntry) error {
err := entry.loadFileIntoCache(ctx)
if err != nil {
return err
}
if !entry.File.Opts.IJson {
return fmt.Errorf("file %s:%s is not an ijson file", zoneId, name)
}
return s.compactIJson(ctx, entry)
})
}
func (s *FileStore) AppendIJson(ctx context.Context, zoneId string, name string, command map[string]any) error {
data, err := ijson.ValidateAndMarshalCommand(command)
if err != nil {
return err
}
return withLock(s, zoneId, name, func(entry *CacheEntry) error {
err := entry.loadFileIntoCache(ctx)
if err != nil {
return err
}
if !entry.File.Opts.IJson {
return fmt.Errorf("file %s:%s is not an ijson file", zoneId, name)
}View on GitHub (pinned to a4447c1563)
Solutions
- Verify the file was created with the IJson option enabled; recreate it with Opts.IJson = true if it was not.
- Check zoneId/name for typos so you are not compacting the wrong file.
- Only run CompactIJson from code paths that own IJson file creation.
Example fix
// before
fs.CompactIJson(ctx, zone, name) // file is a plain file
// after
if file, _ := fs.StatFile(ctx, zone, name); file != nil && !file.Opts.IJson {
return fmt.Errorf("%s:%s is not ijson", zone, name)
}
fs.CompactIJson(ctx, zone, name) Defensive patterns
Strategy: validation
Validate before calling
if fi, err := fs.StatFile(ctx, zone, name); err == nil && !fi.Opts.IJson {
return fmt.Errorf("%s:%s is not ijson; cannot compact", zone, name)
} Type guard
func isIJson(f *fs.FileInfo) bool { return f != nil && f.Opts.IJson } Try / catch
_, err := fs.CompactIJson(ctx, zone, name)
if err != nil && strings.Contains(err.Error(), "is not an ijson file") {
// wrong file type: recreate as IJson or use regular compaction
} Prevention
- Create all command-log files with Opts.IJson = true in one shared helper.
- Keep zone/name constants together with the flags they were created with.
- Gate compaction jobs on the IJson flag rather than name conventions.
When it happens
Trigger: Calling CompactIJson(ctx, zoneId, name) on a file whose File.Opts.IJson flag is false — i.e. the file was created via WriteAt/regular writes without the IJson option set at creation time.
Common situations: Config drift where the creating code no longer sets Opts.IJson but the compacting job assumes it; pointing a compaction routine at a zone/file name that holds a normal file; migration scripts compacting legacy files.
Related errors
- Invalid path part: ${pathPart}
- Invalid command path: ${formatPath(path)}
- Invalid command type: ${commandType}
- convertFileUIMessagePart expects 'file' type, got '%s'
- convertFileAIMessagePart expects 'file' type, got '%s'
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/bd4e6f18090473b6.
Report an issue: GitHub.