TOOLS-474: error when JSON type is used with invalid flags
TOOLS-465: fix deadlock in processing goroutines