{"record":{"id":"29c13caadd46a9c5","repo":"apache/beam","slug":"schema-with-id-this-schema-id-has-encoding-positions-set","errorCode":null,"errorMessage":"Schema with id ${this.schema.id} has encoding_positions_set=True, but not all fields have encoding_position set","messagePattern":"Schema with id (.+?) has encoding_positions_set=True, but not all fields have encoding_position set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/typescript/src/apache_beam/coders/row_coder.ts","lineNumber":344,"sourceCode":"    return new RowCoder(RowCoder.inferSchemaOfJSON(obj));\n  }\n\n  constructor(rawSchema: Schema | Uint8Array) {\n    const schema: Schema =\n      rawSchema instanceof Uint8Array\n        ? Schema.fromBinary(rawSchema as Uint8Array)\n        : (rawSchema as Schema);\n    this.schema = schema as Schema;\n    this.nFields = this.schema.fields.length;\n    this.fieldNames = this.schema.fields.map((f: Field) => f.name);\n    this.fieldNullable = this.schema.fields.map((f: Field) => f.type?.nullable);\n    this.encodingPositions = this.schema.fields.map((_, i) => i);\n\n    if (this.schema.encodingPositionsSet) {\n      // Should never be duplicate encoding positions.\n      let encPosx = schema.fields.map((f: Field) => f.encodingPosition);\n      if (encPosx.length !== this.encodingPositions.length) {\n        throw new Error(\n          `Schema with id ${this.schema.id} has encoding_positions_set=True, but not all fields have encoding_position set`,\n        );\n      }\n      // Checking if positions are in {0, ..., length-1}\n      this.encodingPositionsAreTrivial = encPosx === this.encodingPositions;\n      this.encodingPositions = encPosx;\n      this.encodingPositionsArgsSorted = argsort(encPosx);\n    }\n\n    this.hasNullableFields = this.schema.fields.some(\n      (f: Field) => f.type?.nullable,\n    );\n    this.components = this.encodingPositions\n      .map((i) => this.schema.fields[i])\n      .map((f: Field) => {\n        if (f.type !== undefined) {\n          return this.getNonNullCoderFromType(f.type);\n        }","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/typescript/src/apache_beam/coders/row_coder.ts#L326-L362","documentation":"RowCoder's constructor validated a schema that declares encodingPositionsSet=true, meaning fields carry explicit encoding_position metadata, yet some fields lack an encodingPosition entry. The schema (id in the message) is the faulty input: it is internally inconsistent between its flag and per-field positions.","triggerScenarios":"Thrown at sdks/typescript/src/apache_beam/coders/row_coder.ts:344 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the producer of the schema so every field's encoding_position is set whenever the schema-level encoding_positions_set flag is true.","If positions are just 0..n-1, clear the encodingPositionsSet flag and let RowCoder assign trivial positions.","Regenerate/re-serialize the schema and confirm all fields round-trip with their positions intact."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}