Skip to content

invalid-initialized-by

Id
@azure-tools/typespec-client-generator-core/invalid-initialized-by

Severity: error

This diagnostic is issued when the initializedBy option in @clientInitialization is not a valid InitializedBy value or is invalid for the client position.

  • Area: SDK client construction. Blocks invalid client initialization metadata that would produce an impossible root or sub-client creation pattern.
  • Not affected: Service operations and request/response payload shapes are unchanged.
@clientInitialization({
initializedBy: InitializedBy.customizeCode | InitializedBy.parent, // `customizeCode` cannot be combined
})
namespace BlobClient {
}

TCGC reports:

Invalid 'initializedBy' value. `InitializedBy.customizeCode` cannot be combined with other values.

Use InitializedBy.individually for root clients, InitializedBy.parent or InitializedBy.individually | InitializedBy.parent for sub clients, or InitializedBy.customizeCode by itself.

@clientInitialization({
initializedBy: InitializedBy.customizeCode,
})
namespace BlobClient {
}