qishibo/AnotherRedisDesktopManager · error
Select a correct Type to encode
Error message
Select a correct Type to encode
What it means
Element UI toast shown when the protobuf viewer's getContent() runs with no selected message type, or with the sentinel value 'Rawproto' still selected. this.selectedType is populated by traversing the loaded protobuf.Root (traverseTypes collects protobuf.Type full names); 'Rawproto' means the app is displaying the raw protobuf dump instead of decoding through a schema, which cannot be used to re-encode typed content.
Source
Thrown at src/components/viewers/ViewerProtobuf.vue:99
return this.proto.map(p => path.basename(p || '')).join(', ');
},
keyHex() {
return this.redisKey.toString('hex');
},
},
mounted() {
this.restoreBinding();
},
methods: {
getContent() {
if (!this.protoRoot) {
this.$message.error('Select a correct .proto file');
return false;
}
if (!this.selectedType || this.selectedType === 'Rawproto') {
this.$message.error('Select a correct Type to encode');
return false;
}
let content = this.$refs.editor.getRawContent();
const type = this.protoRoot.lookupType(this.selectedType);
try {
content = JSON.parse(content);
} catch (e) {
this.$message.error(this.$t('message.json_format_failed'));
return false;
}
// toJSON() shows int64/uint64 as strings; fromObject converts them back
const message = type.fromObject(content);
const err = type.verify(message);
if (err) {
this.$message.error(`Proto Verify Failed: ${err}`);View on GitHub (pinned to c149855106)
Solutions
- Pick a concrete message type (not Rawproto) from the type dropdown above the editor, then save
- If only Rawproto appears, the loaded .proto declares no message types — check it exports a message and reselect the file
- Ensure the earlier decode succeeded; a failed decode leaves the viewer in raw mode
Example fix
// before
if (!this.selectedType || this.selectedType === 'Rawproto') {
this.$message.error('Select a correct Type to encode');
return false;
}
// after - same guard, plus disable save in the template
<el-select v-model="selectedType" :disabled="!protoRoot">...</el-select>
<el-button :disabled="!protoRoot || !selectedType || selectedType === 'Rawproto'" @click="save">Save</el-button> Defensive patterns
Strategy: validation
Validate before calling
const t = this.selectedType;
if (!t || t === 'Rawproto') {
this.$message.error('Select a correct Type to encode');
return false;
} Type guard
const isEncodableType = (t) => Boolean(t) && t !== 'Rawproto';
Prevention
- Default selectedType to the first message type after a successful proto load
- Disable save when the dropdown shows Rawproto
- Verify the .proto declares at least one message before enabling the type selector
When it happens
Trigger: Loading a key whose content failed schema decode, causing the type dropdown to stay on 'Rawproto'; selecting an empty option in the type el-select; opening a key bound to a .proto that declares no message types; submitting before choosing a type after loading the proto files.
Common situations: The chosen .proto compiles but declares only enums/services with no message; the decode step failed earlier and silently left selectedType unset; the user assumes the previous key's type selection persists across keys.
Related errors
- Select a correct .proto file
- this.$t('message.group_name_required')
- this.$t('message.group_exists')
- this.$t('message.json_format_failed')
- Proto Verify Failed: ${err}
AI-assisted analysis of qishibo/AnotherRedisDesktopManager@c149855106 (2026-08-22).
Data as JSON: /api/errors/013799b1e1f01250.
Report an issue: GitHub.