{"record":{"id":"2301a7cd0619eb15","repo":"pulumi/pulumi","slug":"only-wrote-d-d-bytes-of-the-schema","errorCode":null,"errorMessage":"only wrote %d/%d bytes of the schema","messagePattern":"only wrote (.+?)/(.+?) bytes of the schema","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/packagecmd/package_extract_schema.go","lineNumber":93,"sourceCode":"\t\t\tdefer contract.IgnoreClose(pctx)\n\n\t\t\tparameters := &plugin.ParameterizeArgs{Args: parameterArgs}\n\t\t\tspec, _, err := packages.SchemaFromSchemaSource(pkgWorkspace.Instance, pctx, source, parameters,\n\t\t\t\tregistry, env.Global(), 0 /* unbounded concurrency */, asExtension, serverURL)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbytes, err := json.MarshalIndent(spec, \"\", \"  \")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbytes = append(bytes, '\\n')\n\t\t\tn, err := cmd.OutOrStdout().Write(bytes)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif len(bytes) != n {\n\t\t\t\treturn fmt.Errorf(\"only wrote %d/%d bytes of the schema\", len(bytes), n)\n\t\t\t}\n\n\t\t\t// Also try to bind the schema to warn about any diagnostics:\n\t\t\t_, err = packages.BindSpec(*spec, schema.NewPluginLoader(pctx))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to bind schema: %w\", err)\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tconstrictor.AttachArguments(cmd, &constrictor.Arguments{\n\t\tArguments: []constrictor.Argument{\n\t\t\t{Name: \"schema-source\"},\n\t\t\t{Name: \"provider-parameter\"},\n\t\t},\n\t\tRequired: 1,","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/packagecmd/package_extract_schema.go#L75-L111","documentation":"`pulumi package extract-schema` verifies that the schema bytes it wrote to stdout were fully written; if the writer accepted fewer bytes than the buffer length it reports the short write.","triggerScenarios":"cmd.OutOrStdout().Write returns n < len(bytes): output stream closed early (broken pipe) or a partial write on a failing descriptor.","commonSituations":"Piping output into a consumer that exits early (head/grep -q), stdout redirected to a full disk or network file that truncates.","solutions":["Write the schema to a file (check for an --out/-o option) instead of piping","Ensure the downstream consumer reads all output before exiting","Check destination disk space and descriptor health"],"exampleFix":"// before\npulumi package extract-schema provider | head\n// after\npulumi package extract-schema provider > schema.json","handlingStrategy":"fallback","validationCode":"# write to file and verify size instead of piping\npulumi package extract-schema <provider> > schema.json && [ -s schema.json ]","typeGuard":null,"tryCatchPattern":"if ! pulumi package extract-schema \"$p\" > schema.json; then echo \"short write or stream failure; redirect to a file instead\"; exit 1; fi","preventionTips":["Redirect to a file rather than pipes that close early","Check disk space on the output target","Avoid consumers that exit before reading all output"],"tags":["cli","io","stdout","schema"],"backgroundTag":"short-write","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}